Logo
Pattern

Discover published sets by community

Explore tens of thousands of sets crafted by our community.

Algorithm Complexity and Big O Notation

7

Flashcards

0/7

Still learning
StarStarStarStar

Constant Time

StarStarStarStar

Big O Notation: O(1) Examples: Accessing a specific array element by index, determining if a number is even or odd.

StarStarStarStar

Linear Time

StarStarStarStar

Big O Notation: O(n) Examples: Summing all elements in an array, linear search on an unsorted array.

StarStarStarStar

Cubic Time

StarStarStarStar

Big O Notation: O(n^3) Examples: Naive matrix multiplication, solving the Rubik's Cube using a straightforward algorithm.

StarStarStarStar

Linearithmic Time

StarStarStarStar

Big O Notation: O(n log n) Examples: Quick sort, merge sort, heap sort for sorting arrays.

StarStarStarStar

Logarithmic Time

StarStarStarStar

Big O Notation: O(log n) Examples: Binary search on a sorted array, finding the largest power of two less than or equal to a given number.

StarStarStarStar

Quadratic Time

StarStarStarStar

Big O Notation: O(n^2) Examples: Bubble sort, insertion sort, and selection sort for small arrays, checking for duplicates in an array by comparing each pair of elements.

StarStarStarStar

Exponential Time

StarStarStarStar

Big O Notation: O(2^n) Examples: Brute-force solutions for the traveling salesman problem, recursive algorithms that generate all subsets of a set (the power set).

Know
0
Still learning
Click to flip
Know
0
Logo

© Hypatia.Tech. 2024 All rights reserved.