CS 1332 Final Exam Extension WS (Time Complexities) & Socrative Polls

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

b

If each vertex in a graph has the maximum amount of outdegree edges, it can be considered to be a(n) _______ graph. a) sparse b) dense c) directed d) undirected

c

If you have a problem that requires pattern matching, but want to minimize the number of characters compared, which pattern matching algorithm should you use? a) Boyer-Moore b) Boyer-Moore w/ Galil Rule c) Rabin Karp d) KMP

b

If you were to run the Kruskal's algorithm on this graph, what is the first edge that will be dequeued from the PQ? a) AC b) AH c) CD d) EF

b, d

In a dense graph, which statement is true? Select all that may apply: a) |E| ≈ |V| b) |E| ≈ |V|^2 c) The graph has few edges relative to the number of vertices d) The graph has a lot of edges relative to the number of vertices e) The graph is disconnected

d

What is a disconnected graph? a) a graph where |E| ≠ |V| b) a non-cyclic graph c) a graph in which every vertex has a path to every other vertex such that there are no isolated vertices d) a graph that contains an isolated vertex; a vertex that can't be reached

b

What is the purpose of Dijkstra's algorithm? a) To find the maximum Vertex b) To find the shortest distance from the start vertex to all other vertices c) To find the minimum spanning tree d) To find the smallest edge weight from only one vertex to another

d

What is the time complexity for performing a Breadth First Search? a) O(|E|) b) O(|V|) c) O(|E|log|V|) d) O(|E| + |V|)

b

What is the time complexity of BFS if the graph is sparse? a) O(1) b) O(|V|) c) O(|E|) d) O(|V| + |E|)

O(|V| + |E|)

What is the time complexity of BFS?

O(|V| + |E|)

What is the time complexity of DFS?

O(|E|log|E|)

What is the time complexity of Dijkstra's algorithm?

O(|E|log|E|)

What is the time complexity of Kruskal's algorithm?

O(|E|log|E|)

What is the time complexity of Prim's algorithm?

d

What is the time complexity of finding the longest common subsequence using Dynamic Programming? Assume the two texts have a length of n and m, respectively. a) O(2^(nm)) b) O(n) c) O(n/m + mn) d) O(nm)

b

What is the time complexity of removing the most recently added element from a queue? a) O(1) b) O(n) c) O(nlogn) d) O(n^2)

b

What is the time complexity of removing the third element in a LinkedList? a) O(n) b) O(1) c) O(3logn)

b

What is the worst case space complexity of a SkipList that is capped at log(n) levels? a) O(logn) b) O(nlogn) c) O(n^2) d) O(1)

b

What is the worst case time complexity of BFS? a) O(n) b) O(|V| + |E|) c) O(|V|) d) O(logn)

c

What is the worst case time complexity of BFS? a) O(|V|) b) O(|E|) c) O(|V| + |E|) d) O(|V| + |E|log|V|)

b

What is the worst case time complexity of accessing an element at index 1000 in an array of length n? a) O(n) b) O(1) c) O(logn) d) O(|E| + |V|)

b

What is the worst case time complexity of adding to an Externally chaining HashMap, using AVLs as its chaining method? You may ignore resize. a) O(nlogn) b) O(logn) c) O(1) d) HashMap's cannot be backed by an AVL

b

What is the worst case time complexity of adding to the back of a Circularly LinkedList without a tail pointer? a) O(n) b) O(1) c) O(n^2) d) Cannot be determined

d

What is the worst case time complexity of finding the largest element in java's priority queue? a) O(logn) b) O(1) c) O(n) d) O(nlogn)

b

What is the worst case time complexity of running Prim's algorithm where the start vertex is disconnected from every other vertex? a) O(|E|log|V|) b) O(1) c) O((|V| + |E|)log|V|) d) None of the above

a

What nodes will be traversed in order to find 35? Commas represent leaving that node and traversing to the next. a) -∞ -> -∞ -> 30 -> 30 b) -∞, -∞, -∞ -∞ 10, 20, 25, 30 c) -∞, 20, 30 d) None of the above

a

What type of edge can only be traversed in one direction? a) directed b) undirected c) sparse d) omnidirectional

c

What would be the best data structure for implementing the waitlist in OSCAR? a) HashMap backed by Heaps b) AVL c) Queue d) Graph

c

What would be the cumulative distance from vertex A to vertex D if we were to run Dijkstra's on the following graph? a) -9 b) -6 c) None of the above

a

Kruskal's algorithm works better in ______ graphs. a) sparse b) dense

a

Back when we were looking at Dijkstra's algorithm, we saw that negative edge weights affected the correctness of Dijkstra's. What can we say about Prim's and Kruskal's algorithm with negative edge weights? a) Neither algorithm is affected by negative edge weights b) Kruskal's algorithm fails for negative edge weights, bu Prim's algorithm is unaffected c) Prim's algorithm fails for negative edge weights, but Kruskal's algorithm is unaffected d) Both Prim's and Kruskal's algorithms fail for negative edge weights

d

Given the following array, select all that apply: a) This is a valid MinHeap b) This is a valid MaxHeap c) This is a valid ArrayList d) None of the aboe

a

Given the following graph and a start vertex of A, in BFS what vertices will first be added to the Queue after Vertex A? a) D, B, C, E b) B, C c) B, G, F, H

c

Given the following tree, what traversal will produce the output 7, 20, 50, 10? a) Level Order b) Preorder c) In Order d) Postorder

b

Given the graph, which algorithm will visit vertex H earlier when starting from vertex A? Break ties in exploring neighbors using alphabetical order. a) BFS b) DFS

c

Given the previous scenario (24/7 Office hours), what graph algorithm might you run in order to find the closest TA? a) DFS b) BFS c) Dijkstra's d) Prim's e) Kruskal's

d

Given the top array, after 1 iteration of which sorting algorithm would produce the bottom array? a) LSD Radix Sort b) Bubble Sort c) Selection Sort, choosing the max element every iteration d) Quick Sort e) None of the above

d

Graham is trying to sort an array size of Graham's number (a very big number). The data consists of only double digit integers and there is sufficient memory in the system. Which algorithm should he use? a) Quick Sort b) Cocktail Shaker Sort c) Heap Sort d) LSD Radix

c

Robert Boyer has moved on from pattern matching and now wants to go into sorting. He has been given the task of sorting data. He's told to choose the algorithm that is the most efficient, but also able to terminate the algorithm early if the data is already sorted. Which algorithm should he utilize? a) LSD Radix b) Heap Sort c) Cocktail Shaker Sort

c

Select the longest subsequence for the string "MOCHI". a) HI b) MOCHIS c) MHI

b

The TAs are starting a new business with several offices; they want to lease phone lines to connect them up with each other. Dr. HB and Professor Faulkner will charge us based off of the number of connections made. The TAs want a set of lines that connect all the offices with a minimum total cost. What algorithm should you use? a) BuildHeap b) Prim's c) Dijkstra's d) BST Search

c

The TAs are trying to develop a new app called 24/7 Office hours. A student will have access to a map of all the TAs on campus. If a student desires help, the app will give directions to the nearest TA on the map. What data structure would be best to use? a) PriorityQueue b) HashMap c) Graph d) LinkedList

b

The node containing 75 is the successor for what node? a) Node containing 100 b) Node containing 50 c) Node containing 25 d) None of the above

True

True or False: A LinkedList is a type of graph.

False

True or False: DFS only works on undirected graphs.

True

True or False: Dijkstra's is a greedy algorithm.

False

True or False: GUO is a valid subsequence in the string GOODLUCK.

False

True or False: In Dynamic Programming we try to break a large problem into smaller subproblems, but these subproblems do not help us solve the larger problem.

False

True or False: In an undirected edge, you can only traverse from vertex u to vertex v. Assume the edge connects vertex u and vertex v.

False

True or False: Running DFS and BFS on the same graph with the same stating vertex will output the same list.

True

True or False: The time complexity for Kruskal's is O(|E|log|E|) for a sparse graph.

False

True or False: This code shows good usage of Dynamic Programming.

True

True or False: This is a valid 2-4 tree.

False

True or False: This tree is balanced and complete.

False

True or False: When comparing the value of objects, you should use the "==" operator to check for equality.

a

Worst case time complexity of converting a MinHeap into a MaxHeap given access to the backing array? a) O(n) b) O(nlogn) c) O(n^2) d) O(logn)

b

Worst case time complexity of finding the kth smallest element of an unsorted array using quick sort? a) O(n) b) O(n^2) c) O(nlogn) d) O(klogn)

b

You actually escaped the cave! You're awarded 1 gold bar for every life you have extra. You're trying to do a favor for fellow gamers and build a map that'll allow you to hit all landmarks in a way that saves you the most lives at the end of the game. Which of the following algorithms can be used to design that map? a) Dijkstra's b) Kruskals c) KMP d) None of the above

c

You are in charge of managing a database of all the users of an email service. As part of your job, you must design a system that allows for multiple users to access their data simultaneously. Which data structure is best for this application? a) 2-4 Tree b) AVL c) SkipList d) HashMap

c

You are playing a game where you are trapped in a cave with a pen and a map and you're planning to escape. You also have 7 lives remaining until the game is over. Now, you are at one landmark and in front of you are 7 different pathways. Your priority is to reach the next landmark to replenish strength and gain extra lives. There may be a chance that several paths may lead to deadly spiders. Which of the following algorithms can be used to avoid any imminent danger? a) DFS b) KMP c) BFS d) Dijkstra's

b

You are playing chess with a grandmaster. You're allowed a computing machine to aid you. The computing machine is capable of simulating all possible sequences and choosing which sequence will lead to the highest probability of winning. Which of the following algorithms are used to simulate each game sequence? a) Prim's b) DFS c) BFS d) Dijkstra's

a

You've been hired at Gradescope and have been tasked with implementing a plagiarism detector software. You want to try to minimize time wasted by making character-by-character comparisons. Which pattern matching algorithm is best suited for this? a) Rabin Karp b) KMP c) Brute Force


संबंधित स्टडी सेट्स

AP English Language and Composition Rhetorical Devices Review

View Set

Chapter 12: Insurance, Licenses, and Permits

View Set

Westward Expansion/Slavery/Causes of Civil War

View Set

INFS2608 Lecture 5 - Relational Model and Relational Algebra

View Set

Economics Chap 14, EC 112- Final Exam

View Set

Mortar Firing Direction Procedures

View Set