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

  1. Choose a pivot element
  2. Partition the array around the pivot
  3. 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

  1. Optimal substructure
  2. Overlapping subproblems

Give an example of a classic Dynamic Programming problem   drill algorithm

Answer

The Fibonacci sequence calculation

Author: Jason Walsh

j@wal.sh

Last Updated: 2024-10-30 16:43:54