Friday, 15 November 2013

Test #2!


I wrote test 2 this week and I don’t think that it went as well as the first test did. Question 3 really stumped me. I ended up writing a very lengthy code, when I’m sure it wasn’t necessary. The question asked us to write code for the function min_path that takes a BSTNode, and builds a linked list of the path from the root to the minimum element. Then, the function returns the first node in the linked list. I feel that I overthought this question and made it seem more difficult than it actually was. After I saw the posted answers to test 2 on the CSC148 website, I saw that the answer to number 3 was:

return LLNode(n.value, min_path(n.left)) if n else None

Hopefully I did better on the other two questions on the test!

2 comments:

  1. I've been reading a lot of people saying they had trouble with question three. I'm surprised nobody has mentioned question one since that was much more difficult compared to question three for me. Anyway good luck! I hope all goes well.

    ReplyDelete
  2. Yes I didn't find question 1 as difficult. I'm glad I wasn't the only one! I got test 2 back today and didn't do so well on the third question. I hope that you did much better than I did!

    ReplyDelete