4.3 - Fundamentals of algorithms Flashcards
What are the applications of a breadth first search?
Finding the shortest path on an unweighted graph.
What are the applications of a depth first search?
Navigating a maze.
What is pre-order tree traversal used for?
Copying a tree.
What is in-order tree traversal used for?
Navigating a binary search tree. Outputting the contents of a binary search tree in ascending order.
What is post-order tree traversal used for?
Infix to RPN (Reverse Polish Notation) conversions, producing a postfix expression from an expression tree, emptying a tree.
What are the benefits of reverse-polish?
Eliminates need for brackets in sub-expressions.
What algorithm has a time complexity of O(log n)?
Binary tree/search.
What algorithm has a time complexity of O(n^2)?
Bubble sort.
What algorithm has a time complexity of O(nlog n)?
Merge sort.