Asymptotic Notation

Ace your homework & exams now with Quizwiz!

Asymptotic Notation (mathematics)

Describes the limiting behavior of a function when the argument tends towards a particular value, or infinity.

Queue: deletion time

O(1)

Queue: insertion time

O(1)

Stack: deletion time

O(1)

Stack: insertion time

O(1)

Array: access time

O(1) - Elements are stored next to one another in memory.

Linked List: deletion time

O(1) - If the address of the node previous to the one to be deleted is known.

Linked List: insertion time

O(1) - If we are at the position where we have to insert an element.

Linked List: access time

O(n)

Linked List: search time

O(n)

Queue: access time

O(n)

Queue: search time

O(n)

Stack: access time

O(n)

Stack: search time

O(n)

Array: search time

O(n) - For sequential search O(logn) - For binary search (if array is sorted)

Array: deletion time

O(n) - The worst case is a deletion at the beginning of the array, causing all other elements to shift.

Array: insertion time

O(n) - The worst case is an insertion at the beginning of the array, causing all other elements to shift.

Asymptotic Notation (CompSci)

Used to classify algorithms according to how their running time or space requirements grow as the input size grows.


Related study sets

Porth's PrepU: Chapter 43: Disorders of the Bladder and Lower Urinary Tract

View Set

Pharmacology Chapter 24 Part 2 --DRUG THERAPY- RECHECKED

View Set

Chapter 11 & 12 corporate finance

View Set