4.3 Fundamentals of Algorithms Flashcards
What is the use of a breadth-first algorithm?
Shortest path for an unweighted graph.
What is the use of a depth-first algorithm?
Navigating a maze
What is the use of a pre-order tree-traversal algorithm?
Copying a tree
What is the use of a in-order tree-traversal algorithm?
Binary search tree Outputting the contents of a binary search tree in ascending order.
What is the use of a post-order tree-traversal algorithm?
Infix to RPN (Reverse Polish Notation) conversions.
Producing a postfix expression from an expression tree.
Emptying a tree.
What is the time complexity of a linear search algorithm?
O(n)
What is the time complexity of a binary search algorithm?
O(log n)
What is the time complexity of a bubble sort algorithm?
O(n^2)
What is the time complexity of a merge sort algorithm?
O(nlog n)
What is the use of Dijkstra’s algorithm?
To find the shortest path