Flashcards › Technology & Coding › Computer Science

Algorithms and Big-O

Classic algorithms, how fast they are, and strategies for solving problems.

63 cardsGrades 9–12, College, Adult#algorithms#sorting#searching#Big-O

0 of 63 known
63 cards
  • AlgorithmTerm
    A finite list of steps that solves a problem
  • Big-O notationTerm
    Describes how running time or memory grows as input grows
  • O(1)Term
    Constant time; stays the same as input grows
  • O(log n)Term
    Logarithmic time; grows slowly, like binary search
  • O(n)Term
    Linear time; grows in proportion to input size
  • O(n log n)Term
    Typical of efficient sorting like merge sort
  • O(n squared)Term
    Quadratic time; typical of simple nested loops
  • O(2 to the n)Term
    Exponential time; becomes huge very quickly
  • Time complexityTerm
    How running time grows with input size
  • Space complexityTerm
    How memory use grows with input size
  • Linear searchTerm
    Check each item in order until found; O(n)
  • Binary searchTerm
    Repeatedly halve a sorted list to find an item; O(log n)
  • Binary search requirementTerm
    The data must be sorted
  • Bubble sortTerm
    Repeatedly swaps adjacent items that are out of order; O(n squared)
  • Selection sortTerm
    Repeatedly picks the smallest item and places it first; O(n squared)
  • Insertion sortTerm
    Builds a sorted list one item at a time; good for small or nearly sorted lists
  • Merge sortTerm
    Splits the list, sorts the halves, then merges; O(n log n)
  • Quick sortTerm
    Picks a pivot and partitions around it; average O(n log n)
  • Heap sortTerm
    Sorts using a heap; O(n log n)
  • PivotTerm
    The element used to partition in quick sort
  • Stable sortTerm
    A sort that keeps equal items in their original order
  • Divide and conquerTerm
    Split a problem, solve the parts, combine the answers
  • RecursionTerm
    A function calling itself on smaller input
  • Base caseTerm
    The stopping point of a recursion
  • Dynamic programmingTerm
    Solve overlapping subproblems once and store the results
  • MemoizationTerm
    Caching results of function calls
  • Greedy algorithmTerm
    Pick the best choice at each step
  • Brute forceTerm
    Try every possibility
  • BacktrackingTerm
    Try choices and undo them when they fail
  • Breadth-first search (BFS)Term
    Explore a graph level by level using a queue
  • Depth-first search (DFS)Term
    Explore a graph as deep as possible using a stack or recursion
  • Dijkstra's algorithmTerm
    Finds shortest paths in a weighted graph with non-negative weights
  • A* searchTerm
    A pathfinding algorithm that uses a guess of distance to the goal
  • Minimum spanning treeTerm
    A tree connecting all nodes with smallest total weight
  • Kruskal's and Prim'sTerm
    Algorithms for finding minimum spanning trees
  • Topological sortTerm
    Ordering tasks so each comes after its prerequisites
  • HashingTerm
    Turning data into a fixed-size number for fast lookup
  • CollisionTerm
    When two keys hash to the same spot
  • Euclid's algorithmTerm
    Finds the greatest common divisor using repeated remainders
  • Sieve of EratosthenesTerm
    Finds all primes up to a number by crossing out multiples
  • Fibonacci sequenceTerm
    Each number is the sum of the two before: 0, 1, 1, 2, 3, 5...
  • FactorialTerm
    n! is the product of all whole numbers from 1 to n
  • Tower of HanoiTerm
    A puzzle that is a classic recursion example
  • Traveling salesman problemTerm
    Find the shortest route visiting every city once; very hard
  • NP-completeTerm
    A class of hard problems with no known fast solution
  • P vs NPTerm
    A famous open question about whether hard-to-solve problems are also easy to check
  • HeuristicTerm
    A practical shortcut that finds a good answer, not always the best
  • PseudocodeTerm
    Plain-language description of an algorithm
  • InvariantTerm
    A condition that stays true during an algorithm
  • Best caseTerm
    The fastest an algorithm can run
  • Worst caseTerm
    The slowest an algorithm can run
  • Average caseTerm
    Typical running time over many inputs
  • In-place algorithmTerm
    Uses very little extra memory
  • Two pointersTerm
    A technique using two positions that move through data
  • Sliding windowTerm
    A technique moving a fixed range along data
  • PageRankTerm
    Google's algorithm that ranks pages by links to them
  • Compression algorithmTerm
    Makes data smaller, like ZIP or JPEG
  • Lossless compressionTerm
    Compression that can be exactly reversed
  • Lossy compressionTerm
    Compression that discards some data, like JPEG
  • Random number generatorTerm
    An algorithm that makes numbers that look random
  • Machine learning algorithmTerm
    An algorithm that learns patterns from data
  • Al-KhwarizmiTerm
    Persian mathematician whose name gave us the word algorithm
  • Algorithm originTerm
    Named after a 9th-century scholar al-Khwarizmi

Download this deck

Want paper cards? Paste the plain-text download into the flashcard maker.

More Computer Science decks