Preview

Big O Algorithm Complexity Sheet

Good Essays
Open Document
Open Document
990 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Big O Algorithm Complexity Sheet
Complexities!
Good Fair Poor

Searching
Algorithm

Data Structure

Time Complexity

Depth First Search
(DFS)

Graph of |V| vertices and |E| edges Graph of |V| vertices and |E| edges Sorted array of n elements Array

-

O(|E| + |V|)

O(|V|)

-

O(|E| + |V|)

O(|V|)

O(log(n))

O(log(n))

O(1)

O(n)

O(n)

O(1)

Graph with |V| vertices and |E| edges O((|V| + |E|) log |V|)

O((|V| + |E|) log |V|)

O(|V|)

Graph with |V| vertices and |E| edges O(|V|^2)

O(|V|^2)

O(|V|)

Graph with |V| vertices and |E| edges O(|V||E|)

O(|V||E|)

O(|V|)

Average

Breadth First
Search (BFS)
Binary search
Linear (Brute
Force)
Shortest path by
Dijkstra,
using a Min-heap as priority queue
Shortest path by
Dijkstra,
using an unsorted array as priority queue Shortest path by
Bellman-Ford

Worst

Space
Complexity
Worst

Sorting
Algorithm

Data
Structure

Time Complexity
Best

Quicksort

Array

Mergesort

Array

Heapsort

Array

Bubble Sort
Insertion
Sort
Select Sort
Bucket Sort
Radix Sort

Array
Array

O(n log(n)) O(n log(n)) O(n log(n)) O(n)
O(n)

Array
Array
Array

O(n^2)
O(n+k)
O(nk)

Average

Worst

Worst Case Auxiliary
Space Complexity
Worst

O(n log(n)) O(n log(n)) O(n log(n)) O(n^2)
O(n^2)

O(n^2)

O(n)

O(n log(n)) O(n log(n)) O(n^2)
O(n^2)

O(n)

O(n^2)
O(n+k)
O(nk)

O(n^2)
O(n^2)
O(nk)

O(1)
O(nk)
O(n+k)

O(1)
O(1)
O(1)

Data Structures
Data Structure

Time Complexity

Indexing

Average
Search
Insertion

Deletion

Basic Array
Dynamic Array
Singly-Linked
List
Doubly-Linked
List
Skip List

O(1)
O(1)
O(n)

O(n)
O(n)
O(n)

-

-

O(n)
O(1)

O(n)

O(n)

O(log(n))

Hash Table
Binary Search
Tree
Cartresian Tree
B-Tree
Red-Black Tree
Splay Tree
AVL Tree

Indexing

Space
Complex
ity
Worst

Worst
Search
Insertion

Deletion

O(n)
O(n)
O(n)

-

-

O(n)
O(1)

O(1)
O(1)
O(n)

O(n)
O(1)

O(n)
O(1)

O(n)
O(n)
O(n)

O(1)

O(1)

O(n)

O(n)

O(1)

O(1)

O(n)

O(log(n))

O(log(n))

O(log(n))

O(n)

O(n)

O(n)

O(n)

O(log(n))

O(1)
O(log(n))

O(1)
O(log(n))

O(1)
O(log(n))

O(n)

O(n)
O(n)

O(n)

You May Also Find These Documents Helpful

  • Satisfactory Essays

    IF You Want To Purchase A+ Work Then Click The Link Below , Instant Download…

    • 503 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    We cannot underestimate nodes like N because although these kind of nodes may have limited neighbor nodes but these neighbors are powerful. By Eigenvector Centrality this aspect of a node is determined. It is very common tendency of the key player of any criminal activity to maintain the gap and privacy from members with less importance or new members that's why node having higher Eigenvector Centrality may be the key node. If network graph is represented in the form of adjacency matrix A then Eigenvector Centrality…

    • 596 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    For the second event Event2, the algorithm C does not abort during the challenge phase if one of d_0 and d_1 is 0. By the definition of H-list Pr[d_b=0]=1/(m!q_T+1) where b∈{0,1} and the two values are independent of one another, we have that both Pr[d_0=d_1=1]=1-1/q_T≥〖(1-1/(q_T+1))〗^2. Hence, the Pr[Event2] is at least 1/q_T. Since A never issues trapdoor queries for target keyword vectors, Event1 and Event2 are independent. Hence, the probability that C does not abort during the entire simulation, that is Pr[Event_1 ∧ Event_2]≥1/(eq_T).…

    • 111 Words
    • 1 Page
    Satisfactory Essays
  • Good Essays

    FOSS (Free and Open Source Software) had some trouble in 2006 when Microsoft submitted 235 patents that were allegedly violated by FOSS. Microsoft created these patents in order to collect royalties from companies in the “free world” (companies/people using free software). Eben Moglen of the Free Software Foundation contended that software is a mathematical algorithm and is not patentable. Moglen wrote, “It’s a tinderbox. As the commercial confrontation between free software and software-that’s-a-product becomes more fierce, patent law’s going to be the terrain on which a big piece of the war’s going to be fought.” FOSS has powerful corporate patrons and allies. So if Microsoft ever tried to sue Linux distributor Red Hat for patent infringement, for instance, OIN might sue Microsoft in retaliation, trying to enjoin distribution of Windows.…

    • 705 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Ops571 Final Exam

    • 1218 Words
    • 5 Pages

    1) __________ is when the activities in the stage must stop because there is no place to deposit the item just completed…

    • 1218 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    IF You Want To Purchase A+ Work Then Click The Link Below , Instant Download…

    • 503 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    In this exercise, you install Windows Server 2012 R2 on a new computer with no previously installed operating system.…

    • 552 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Os 571 Flow Chart Paper

    • 654 Words
    • 3 Pages

    6. Is my outfit ready from the night before or do I have to think what to wear? Shoes, which ones will match my outfit?…

    • 654 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    To achieve a merit evidence must show that, in addition to the pass criteria, the learner is able to:…

    • 623 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Cs Programming Chapter 1

    • 2450 Words
    • 10 Pages

    ____ data items may involve organizing or sorting them, checking them for accuracy, or performing calculations with them.…

    • 2450 Words
    • 10 Pages
    Satisfactory Essays
  • Good Essays

    In “Big Ideas, Big Problems” written by Stefan Halper, Halper discusses the two issues, Big Ideas and constant media, that negatively affect U.S policies and its public. Advertised sloganeering along with America’s susceptibility to overly cumbersome political movements is the root of the problems that push citizens to feel patriotic in a negative and irrational way. Halper goes on to discuss the issues that continuously arise from each major world crisis by stating “each has suffered [from] … ill-conceived policy responses.” This lack of understating of foreign policies leads to citizens blowing things out of proportion and making simple ideas Big Ideas that are perceived as threats in comparison to American policies. During the Cold War,…

    • 366 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    Program Evaluation Fast

    • 4469 Words
    • 18 Pages

    efficiency and effectiveness of the FAST program is constrained by a number of challenges that…

    • 4469 Words
    • 18 Pages
    Powerful Essays
  • Satisfactory Essays

    ocr exam paper

    • 5083 Words
    • 21 Pages

    Write your name clearly in capital letters, your Centre Number and Candidate Number in the boxes…

    • 5083 Words
    • 21 Pages
    Satisfactory Essays
  • Best Essays

    Angiullo in Hopkins ’book ‘Learning from High Reliability Organisations’ (2009, p.147) stated that “Any well designed safety program or system is only as effective as the day-to-day ability of everyone in the organisation to rigorously follow procedures correctly and safely every time.”…

    • 3545 Words
    • 9 Pages
    Best Essays
  • Good Essays

    5. What distinguishes a Loop control construct from a While control construct, in terms of what is known about the number of times the block of code will be repeated?…

    • 610 Words
    • 3 Pages
    Good Essays