Section 3 Flashcards
What is the following calculation in reverse polish Notation: 3 * 4
3 4 *
What is the following calculation in reverse polish Notation: (5 * 2) + 7
5 2 * 7 +
What is the following calculation in reverse polish Notation: 5 * 4 + 3 * 2
5 4 * 3 2 * +
what are the benefits of RPN
RPN doesn’t require brackets and can be implemented easily on a stack
Which is faster - Binary search or Linear Search
Binary Search
What needs to be true before you can use Binary Search
the list needs to be sorted
What does pre-order mean
If each node is visited before both of its subtrees
Visit the root node (generally output it)
Do a pre-order traversal of the left subtree
Do a pre-order traversal of the right subtree
what does in-order mean?
If each node is visited between visiting its left and right subtrees
Do an in-order traversal of the left subtree
Visit root node (generally output this)
Do an in-order traversal of the right subtree
What is post-order
If each node is visited after its subtrees
Do a post-order traversal of the left subtree
Do a post-order traversal of the right subtree
Visit the root node (generally output this)
What does the Dijkstra’s Algorithm do?
Calculates the shortest path from a starting point to an end point.
Applications of the Dijkstra Algorithm
- Geographical Information Systems such as satellite navigation.
- Network routing and package switching, used to send data packages along the most efficient route