CSC 202

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Breadth first search is a graph traversal algorithm that visits all the vertices in a graph by exploring all the neighbors at the current depth level before moving on to the next depth level. (always finds the shortest path)

Breadth First Search

O(n)

Breadth First Search of a graph Tim complexity

O(nlogn)

Build a Binary Heap by repeated insertion (enqueue) of keys time complexity

O(logn)

Build a Binary Heap using the Bottom Up method time complexity

O(n)

Choose the big O description that provides the tightest accurate running time bound to adding n elements to a hash table as presented or implemented in this class, assuming a low load factor and efficient hash function.

at root of tree

Consider a full Binary Search Tree. The median key value is located

directed acrylic graphs

DAGS

O(1)

Delete the first (head) node from a doubly linked list, assuming a sentinel node implementation what is time complexity

O(n)

Depth First Search of a graph time complexity

Depth first search is a graph traversal algorithm that explores as far as possible along each branch before backtracking (does not always find shortest path)

Depth first search

O(1)

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

O(n)

Find the minimum key in a Max Binary Heap time complexity

n/2

For Merge Sort, if we have two arrays, each of size n/2 (assume n is even), what is the fewest number of comparisons that could be made during the merge operation (in terms of n)?

n-1

For Merge Sort, if we have two arrays, each of size n/2 (assume n is even), what is the greatest number of comparisons that could be made during the merge operation (in terms of n)?

Shove all items into priority queue take them out smallest to largest

Heap Sort

I // 2

In a binary heap, what is the location of a parent node for any arbitrary node located at index i ?

print node when visited twice

In order

Go through list comparing each value to values before current value if value is less than any insert before that value O(n^2)

Insertion Sort

O(logn)

Perform Heap Sort on random set of data time complexity

print node when visited three times

Post order

print node when visited once

Pre order traversal

The same but quick sort uses pivot which makes it not require extra O(n) space that merge sort does

Quick Sort vs Merge Sort

O(long)

Remove (dequeue) the maximum key from a Maximum Binary Heap, and restore the heap order Time complexity

O(n)

Resize a hash table time complexity

Find the smallest item put it at 1st Find next smallest item put it at 2nd and so on... O(n^2)

Selection Sort

.5

What is load fact or restriction for quadratic probing?

queue

Which ADT is used for a Breadth First Search of a graph?

stack

Which ADT is used for a Depth First Search of a graph?

O(n^2(

bubble sort time complexity

O(nlogn)

dequeueing n items from a binary heap (average case) time complexity

O(1)

find key in hash table time complexity

Given a directed graph output all the vertices such that no vertex is outputted before any other vertex with an edge

topological sort

.7-.8

what is load factor restriction for linear probing ?

Doesn't really matter but usually around .9

what is load factor restriction for separate chaining ?


Kaugnay na mga set ng pag-aaral

(PrepU) Psychosocial Well-Being: Nursing Concepts

View Set

Multiple-subject Practice test 2

View Set

Ap government civil liberties and civil rights frqs

View Set

Cardiac NCLEX questions PEDIATRIC

View Set

MNO Exam 2: Teamwork Study Guide

View Set

Acct 313 Exam 3 - Chap 8/9, 10, 11

View Set

Math- Multiplication and Division

View Set

Chapter 2: Evaluating Nutrition Information

View Set

chapter 68 High-Risk Pregnancy and Childbirth

View Set