CPE202 - Time Complexities

Ace your homework & exams now with Quizwiz!

max # of key comparisons for Merge Sort

2n

time complexity of search( ) for an Ordered List

O(logn)

best case for Quick Sort (comparisons/swaps)

O(n logn)

time complexity of print in sorted for a Hash Table

O(n logn)

time complexity of print in sorted for a Heap

O(n logn)

worst/average case for Heap Sort (comparisons/swaps)

O(n logn)

min # of key comparisons for Merge Sort

n

time complexity of predecessor/successor for a Heap

O(n)

time complexity of print in sorted for Balanced Binary Search Tree

O(n)

time complexity of print in sorted for Ordered List

O(n)

time complexity of remove( ) for an Ordered List

O(n)

time complexity of remove( ) for an Unordered List

O(n)

time complexity of search( ) for an Unordered List

O(n)

time complexity of search( ) for a Heap

O(n), O(1)

worst case, average/best case delete( ) for a Binary Search tree

O(n), O(log n)

worst case, average/best case find(item) for a Binary Search tree

O(n), O(log n)

worst case, average/best case find_max/min( ) for a Binary Search tree

O(n), O(log n)

worst case, average/best case insert( ) for a Binary Search tree

O(n), O(log n)

worst case for Insertion Sort (comparisons/swaps)

O(n^2)

worst case for Quick Sort (comparisons/swaps)

O(n^2)

worst case for Selection Sort (comparisons/swaps)

O(n^2)

worst case, best case for Bubble Sort (comparisons/swaps)

O(n^2)

worst case, average case for building a Binary Search tree

O(n^2), O(nlog n)

time complexity of building a Heap w/ Top Down method

O(nlog n)

worst/best case for Merge Sort (comparisons/swaps)

O(nlog n)

(average) time complexity of delete( ) for a Hash Table

O(1)

(average) time complexity of insert( ) for a Hash Table

O(1)

time complexity of find min/max( ) for a Hash Table

O(n)

time complexity of find min/max( ) for an Unordered List

O(n)

time complexity of predecessor/successor for a Hash Table

O(n)

time complexity of dequeue( ) for a Queue (circular array / linked list implementation)

O(1)

time complexity of enqueue( ) for a Queue (circular array / linked list implementation)

O(1)

time complexity of find kth( ) for an Ordered List

O(1)

time complexity of find min/max( ) for a Heap

O(1)

time complexity of find min/max( ) for an Ordered List

O(1)

time complexity of insert( ) for an Ordered List

O(1)

time complexity of insert( ) for an Unordered List

O(1)

time complexity of peek( ) for a Stack

O(1)

time complexity of pop ( ) for a Stack

O(1)

time complexity of predecessor/successor for Ordered List

O(1)

time complexity of predecessor/successor for a Balanced Binary Search Tree

O(1)

time complexity of push( ) for a Stack

O(1)

time complexity of search( ) for a Hash Table

O(1)

time complexity of enqueue( ) & dequeue( ) if used regular lists (book's method)

O(1), O(n)

time complexity of Depth First Search for a Graph

O(V + E)

time complexity of delete( ) for a Heap

O(log n)

time complexity of find kth( ) for a Balanced Binary Search Tree

O(log n)

time complexity of insert( ) for a Heap

O(log n)

best case for Insertion Sort (comparisons/swaps)

O(n)

best case for Selection Sort (swaps)

O(n)

space requirement for Merge Sort

O(n)

time complexity of building a Heap w/ Bottoms Up method

O(n)

time complexity of find kth( ) for a Heap

O(n)

time complexity of find kth( ) for an Hash Table

O(n)


Related study sets

Gov and Economics Chapter 8 The Stock Market

View Set

Nursing-110: Health Care Law & HIPAA

View Set

Employee Benefits Final Exam- Tammi Metz

View Set

AP Euro Period 2 Fiveable Key Terms

View Set

Bio 115 Cellular Organelle Chart

View Set