CPE 202 - Parkinson: Time Complexities (cumulative)

Ace your homework & exams now with Quizwiz!

Add a new node to the head of a linked list as in Question 4 above

O(1)

Assuming a circular array implementation for a Queue as in Lab 3, the dequeue() operation

O(1)

Find a key in a hash table (typical case, efficient hash table, low load factor)

O(1)

Find a key in a hash table (typical case, low load factor)

O(1)

Given a key, remove the key/value pair from a hash table (typical case, efficient hash table, low load factor)

O(1)

Perform peek operation to return (but don't delete) minimum key from Minimum Binary Heap

O(1)

Return the value of the first entry in a Python List

O(1)

Use of the append operation to add an item to a Python List

O(1)

Binary search on an ordered list implemented with an array

O(log(n))

Execute a binary search for a value within an already sorted Python List

O(log(n))

Find the minimum key in a Red-Black Tree

O(log(n))

Remove (dequeue) the maximum key from a Maximum Binary Heap

O(log(n))

Worst case for the insertion of a key into a Red-Black Tree

O(log(n))

Add a new node to the tail end of a linked list that only has a head reference (no tail reference in the linked list class)

O(n)

Breadth First Search of a graph

O(n)

Build a Binary Heap using the Bottom Up method

O(n)

Find a node containing a certain data value within a linked list

O(n)

Find the height of a Red-Black Tree

O(n)

Find the minimum value in a Python List of random integers

O(n)

Given a starting vertex, searching for all vertices in a connected graph

O(n)

In-order traversal of a Red-Black Tree

O(n)

Perform "bottom up" construction of a binary heap

O(n)

Perform Insertion Sort on an already sorted set of data

O(n)

Resize a hash table (e.g. growing hash table as in Project 4, when load factor > .5)

O(n)

Sequential (linear) search for an item in a Python List

O(n)

Sum the values of a Python List of integers

O(n)

Worst case for the insertion of a key into a "standard" Binary Search Tree

O(n)

Build a Binary Heap by repeated insertion of keys

O(nlog(n))

Merge sort time complexity, guaranteed

O(nlog(n))

Perform "top down" construction of a binary heap (repeated insertions of keys)

O(nlog(n))

Perform Heap Sort on a sorted list

O(nlog(n))

Perform Heap Sort on an already sorted set of data

O(nlog(n))

Perform Heap Sort on random set of data

O(nlog(n))

Perform Merge Sort on random set of data

O(nlog(n))

Perform Quick Sort on random data, using "median of 3" pivot (average case)

O(nlog(n))

Starting with empty Red-Black Tree, build a tree with "n" insertions

O(nlog(n))

Suppose we have an O(n) time algorithm that finds the median of an unsorted array. Now consider a Quick Sort implementation where we first find the median using the above algorithm, then use the median as the pivot. What will be the worst case time complexity of this modified Quick Sort, including the operation that finds the median?

O(nlog(n))

Perform Bubble sort on random set of data

O(n²)

Perform Insertion Sort on random set of data

O(n²)

Perform Quick Sort on already sorted set of data, using value at first index for pivot

O(n²)

Perform Selection Sort on random set of data

O(n²)

Use of the pop(0) operation to repeatedly remove all items from a Python List

O(n²)

Dequeue an item from a queue (do not assume an implementation)

Varies


Related study sets

CompTIA CySA+ (CS0-002) Practice Exam 3

View Set

Chapter 16: Sustainable Marketing

View Set

hbio301 ch6 bones and skeletal tissue

View Set

The structure of Cells & labeling a plant and animal cell and a mitochondria and a chloroplast

View Set