Docsity

Time Complexity Analysis: BigO, Big-Omega, Big-Theta Notations and Examples, Quizzes of Computer Science

Toggle sidebar
bg1
TERM 1
BigO
Notation
DEFINITION 1
Upper bound for time costs.If the algoritm is O(n), then its
performance is <= n.
TERM 2
Big-Omega
Notation
DEFINITION 2
Lower bound for time cost.If the algorithm is Omega(n), then
its performance is >= n.
TERM 3
Big-Theta
Notation
DEFINITION 3
Tight bound for time costIf the algorithm is Theta(n) then its
performance = n.
TERM 4
Increasing order of time costs
DEFINITION 4
O(1) < O(logn) < O(n) < O(nlogn) < O(n^2) < O(2^n)
TERM 5
Time Complexity for Singly Linked List
DEFINITION 5
Worst case
Read at an index: O(n)
add/remove at head: O(1)
add/remove at tail: O(n)
add/remove in interior: O(n)
resize: NA
find by integer: O(n)
find by target: O(n)
[difference btw this an singly linked list]
pf2

Partial preview of the text

Download Time Complexity Analysis: BigO, Big-Omega, Big-Theta Notations and Examples and more Quizzes Computer Science in PDF only on Docsity!

TERM 1

BigO

Notation

DEFINITION 1 Upper bound for time costs.If the algoritm is O(n), then its performance is <= n. TERM 2

Big-Omega

Notation

DEFINITION 2 Lower bound for time cost.If the algorithm is Omega(n), then its performance is >= n. TERM 3

Big-Theta

Notation

DEFINITION 3 Tight bound for time costIf the algorithm is Theta(n) then its performance = n. TERM 4

Increasing order of time costs

DEFINITION 4 O(1) < O(logn) < O(n) < O(nlogn) < O(n^2) < O(2^n) TERM 5

Time Complexity for Singly Linked List

DEFINITION 5 Worst case Read at an index: O(n) add/remove at head: O(1) add/remove at tail: O(n) add/remove in interior: O(n) resize: NA find by integer: O(n) find by target: O(n) [difference btw this an singly linked list]

TERM 6

Time Complexity for Doubly Linked List

DEFINITION 6 Worst case Read at an index: O(n) add/remove at head: O(1) add/remove at tail: O(1) add/remove in interior: O(n) resize: NA find by integer: O(n) find by target: O(n) [difference btw this an singly linked list] TERM 7

Variance

DEFINITION 7 The average of thesquareddifferences from the Mean,a measure of how far a set of numbers is spread out. var = 1/n*sum(data-mean)^ TERM 8

Standard

Deviation

DEFINITION 8 Square root of the variance; how much variation or dispersion exists from the average (mean), or expected value.std = sqrt(var) = sqrt(E[x - mean]^2) = sqrt(E[x^2] - E[x]^2) TERM 9

Array Operations

DEFINITION 9 Arrays are random access structures, meaning the have the abilitiy to access an element at an arbitrary position in a sequence in equal time. Read at index: O(1) add/remove at front: O(n) add/remove at end: O(1) resize: O(length of new array) find by index: O(1) find by target: O(n)