1. Sequences of items; can be added, removed, accessed by position.
2. Specialized list where we only have access to most recently added item.
3. Collection of items accessed by their associated keys.
(from Danny's ppt)
We have discussed several examples in order to understand it. (Stacks, Queues(in lab), Trees etc)
These weeks we are focusing on class Trees. The Tree has children and values and we named the children who has no child leaves. And the BTNode is a binary Tree code which has left children and right children. When it comes to BTNode's leaves, we have the left children and the right children are both equal to None.
And we combine recursion with the class BTNode which is a bit confusing. Let me make an example.
We recall the function list_longest_path itself to solve the problem. We first consider the easiest two conditions and then we extend it to the complicated conditions.

没有评论:
发表评论