MIDTERM 2
it was a really frustrating experience writing this test. I expected everything from the second half of our syllabus like binary search tree, pre-order, in-order traversal, and the big-Oh especially.
```````````````
Note: tree traversal is a systematic way of going through each node of the binary tree. Usually used for searching a node.
Pre-order traversal
1.root
2.left child
3.right child
Post-order traversal
1.left
2.right
3.root
In-order traversal
1. left
2. root
3. right
```````````````
Big-Oh is basically just a count of how much work to go through for each algorithm.
If an algorithm counts how many numbers are in a list, this is O(n), because it just counts n numbers.
An algorithm that looks for an x in list A that is also in list B takes O(n squared). because for each item in A going through, One has to look for at most n times in list B that matches.
```````````````
Anyhow, the test was mostly about recursions which I am worst at. I took the first 15 min thinking about what I can grab from mid-air. I don't think I've received a good mark on it, but I do know where to work on for my final now. The good thing was I was not completely blank about the questions, but it just took me longer than usual to work them out.
No comments:
Post a Comment