Algorithm Flashcards: A Study Aid for Common Algorithmic Problems
Table of Contents
Sorting Algorithms
What is the time complexity of Bubble Sort? drill algorithm
Answer
O(n2)
Describe the basic idea of Quicksort drill algorithm
Answer
- Choose a pivot element
- Partition the array around the pivot
- Recursively sort the subarrays
What is the average time complexity of Merge Sort? drill algorithm
Answer
O(n log n)
Searching Algorithms
What is the time complexity of Binary Search? drill algorithm
Answer
O(log n)
Describe the basic idea of Depth-First Search (DFS) drill algorithm
Answer
Explore as far as possible along each branch before backtracking
Graph Algorithms
What is the purpose of Dijkstra's algorithm? drill algorithm
Answer
To find the shortest path between nodes in a graph
What problem does the Bellman-Ford algorithm solve? drill algorithm
Answer
Finds shortest paths from a source vertex to all other vertices, even with negative edge weights
Dynamic Programming
What are the two main properties of Dynamic Programming problems? drill algorithm
Answer
- Optimal substructure
- Overlapping subproblems
Give an example of a classic Dynamic Programming problem drill algorithm
Answer
The Fibonacci sequence calculation