Monday, March 17, 2014

Week #9



A node-based binary tree data structure was introduced last week, and we have more on it this week. Data in left subtree of a binary search tree is less than that in the root and data in right subtree is greater than that in the root, both left and right subtree are also binary search tree if they are not None. The nodes in binary tree are called binary tree node which has its own data and left children and right children. Below is an example of a binary search tree of depth 3, with root 8 and leaves 1, 4, 7 and 13




BST is efficient as it allows us to ignore half of the list. For instant, we need to search a value v in a BST with rooted data t, then there are 3 possibilites: rooted data t equals the value v, or t is less than v and then only search right subtree only, or t is greater than v then search left subtree only.

This week I completed Exercise 3 and are starting Assignment 2part2. Again, I'm doing them along and I enjoy coding at this way. When something confuses me, I'll use all sources(google,TA, Piazza,office hour) to figure it out. I also found that it helps to read others slogs, such as this http://haleyyewslog.blogspot.ca/, I got some senses for Assignment 2.

No comments:

Post a Comment