Data Structures Final

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Manber and Myers published an improved suffix array algorithm in 1993 that is O(_______) run time.

n log n

Preorder traversal

root, left, right

Which data structure is used for implementing recursion? a. queue b. stack c. array d. linked list

stack

What is the worst time complexity for searching for an element in an ordered single linked list? a. O(1) b. O(n^2 c. O(n log n) d. O(n)

O(n)

The time complexity of the binary sort algorithm is

O(n^2)

What is the worst case run time for the Naive suffix array construction algorithm?

O(n^2)

What is the max number of nodes in a binary tree with height h?

2^(h+1)-1

What is the maximum number of nodes in a binary tree of height h.

2^(h+1)-1

How many nodes are in a full binary tree having k levels?

2^(k)-1

What is the maximum level number in a binary tree containing n nodes?

2^(n-1)

The number of elements in the adjacency matrix of a graph having 7 vertices is _______ a. 7 b. 14 c. 36 d. 49

49

How many comparisons would the Selection Sort make on an array of 8 elements that is already in ascending order?

8(8-1)/2 --> 56/2 = 28

A hash function should have which properties? a. Uniform distribution b. Speedy computation c. Range is a subset of the integers d. Equivalent objects produce equal hash

All of the above

The time complexity to calculate the number of edges in a graph whose information is stored in the form of an adjacency matrix is ______ a. O(V) b. O(E^2) c. O(E) d. O(V^2)

O(V^2)

Which sorting algorithm runs faster on a sequence that is in reverse order(worst case) than on a random sequence?

Heap Sort O(n log n)

The time complexity of the merge sort algorithm is

O(n log n)

Which sorting algorithm runs in linear(O(n)) in the best case

Insertion Sort

Which sorting algorithm makes the fewest number of comparisons on a sequence whose elements are all equal?

Insertion Sort (because there's no need to compare)

Which sorting algorithms uses the most amount of space to sort a sequence on 'n' elements?

Merge Sort

What is the big-O complexity to retrieve from a hash table if there are no collisions? a. O(1) b. O(n) c. O(n^2) d. O(log n)

O(1)

Which sorting algorithm is not stable?

Quick Sort

In which case adjacency list is preferred in front of an adjacency matrix? a. Dense graph b. Sparse graph c. Adjacency list is always preferred d. None of the mentioned

Sparse graph

What is the primary disadvantage of suffix trees over suffix arrays?

Suffix trees have a longer runtime and use more space

Enqueue

To add an item to the rear of a queue.

Dequeue

To remove an item from the front of a queue.

What is the maximum possible number of edges in a directed graph with no self loops having 8 vertices? a. 28 b. 64 c. 256 d. 56

V-(V-1) --> 8(8-1) --> 8*7 = 56

Circle all the open addressing approaches to hash table collisions a. Linear probing b. Search probing c. Exponential hashing d. Separate chaining

a & b

What is the disadvantage of using an array of even size as the basis for a hash table? a. Takes more space b. Produces more collisions c. Quadratic probing takes more time d. Complicates item removal

b

Linked list is considered as an example of a _______ data structure. a. static b. FIFO c. LIFO d. dynamic

dynamic

Queue

first-in,-first-out (FIFO) data structure

Stack

last-in, first-out (LIFO) data structure.

Postorder traversal

left, right, root

Inorder traversal

left, root, right

The topological sorting of any DAG can be done in ______ time. a. cubic b. quadratic c. linear d. logarithmic

linear


Ensembles d'études connexes

ACloud Guru Certified Cloud Practitioner Practice Exam

View Set

Chapter 26 Study Guide Questions

View Set