Sunday, 5 April 2015

Week 9 Impressions

Week 9 had a big emphasis on efficiency with BST nodes. The lab we completed focused on the different ways to put nodes into a tree. One exercise consisted of creating a balanced_delete method to allow the new tree look more like a binary tree. The second exercise was investigating the efficiency of the height and contains methods of trees. While there wasn't a very clear way to approach the question, I learned that the most efficient way to put nodes in a BST tree is with the random module. Without the random module, I was placing nodes in a linear order. While the linear approach is fine when you have a list with a short length, it becomes extremely inefficient when the length of your list is a very large number.  It would take a very long time to find a number at the bottom of the tree when using the contains method (as it would go through each node in descending order) and it would take a long time to find the length. However, the random module helped me generate a random node and placed it accordingly to where the node.data was so my tree's height can be shorter and the contains method takes less time finding the node. I felt that this week is the start of the beginning of efficiency with big Oh, and I'm looking forward to learning that.

No comments:

Post a Comment