COMSC-210 Midterm Exam Practice Test, COMSC-210 Quiz: AVL Trees, COMSC-210 Quiz: Hash Tables

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

Using double hashing, how is the index determined when inserting item 20? hash1(key) = key % 11 hash2(key) = 5 - key % 5 and a hash table with a size of 10

(20 % 11 + 0 * (5 - 20 % 5)) % 10

If a hash table has 20 buckets and 12 elements, what will the load factor be?

0.6

If (H+c1*i+c2*i^2)\bmod(tablesize) maps to an occupied bucket, then the item's index (i) is incremented by _____.

1

Given the list (37, 33, 40, 12, 15, 16, 25, 42), what is the new array after the first iteration of shell sort's outer loop with a gap value of 4?

15, 16, 25, 12, 37, 33, 40, 42

Given the following hash table, how many items are compared when searching for item 45 using the following search algorithm?

2 items: 25 and 45

Consider the following hash table, and a hash function of key % 10. How many list items will be compared for the search operations? HashInsert(newTable, item 25) HashInsert(newTable, item 54) HashRemove(newTable, 27) HashInsert(newTable, item 84) HashInsert(newTable, item 83) HashSearch(newTable, 72) HashSearch(newTable, 77) HashSearch(newTable, 63)

2; 0; 1

Assume an ordered list containing the English alphabet. Using binary search, how many letters are checked to locate the letter "K"?

4

A 5-bucket hash table has the items 45, 56, and 67. The hash table's items will be positive integers. Which of the following is the correct way of representing the hash table?

45, 56, 67, -1, -1

Consider the following hash table, and a hash function of key % 5. What would bucket 3's list be after the following operations? HashRemove(hashTable, 25) HashRemove(hashTable, 48) HashInsert(hashTable, item 53)

68, 33, 53

A hash table named numTable uses a hash function of key % 10 and quadratic probing with c1 = 1 and c2 = 2. Into which bucket is item 44 inserted? HashInsert(numTable, item 1)HashInsert(numTable, item 12)HashInsert(numTable, item 23)HashInsert(numTable, item 34)HashInsert(numTable, item 44)

7

Adding BADMINTON to the trie below creates _____ new nodes.

8

For a 100-entry hash table, compute the multiplicative hash for the string JAVA using the specific initial value 6 and hash multiplier 2. The decimal ASCII value for each character is given below.

85

Which abstract data type (ADT) is most suitable to store a list of perishable products such that the product with the nearest expiry date is removed first?

A priority queue

Which abstract data type (ADT) is best suited to store the names of all currently available smartphone models?

A set

Which of the following is correct for a list ADT?

An element can be found and removed from the end of the list.

Three is the minimum possible height of an AVL tree with 7 nodes.

False

Which of the following is a constant time operation?

Finding the sum of two numbers input by the user

Which collision resolution technique places the item in another empty bucket?

Open addressing

Given a Queue implemented as a linked list, identify the correct dequeue algorithm.

QueueDequeue(queue) { headData = queue⇢head⇢data ListRemoveAfter(queue, null) return headData }

"Major" becomes "Pdmru" after encryption. Identify the correct Caeser cipher used.

Right shift of 3

Which of the following statements is correct? The queue ADT supports the insertion and deletion of items at the front and the back. The queue ADT supports the printing of the list contents but the list ADT does not. The queue ADT supports the removing of items from one end and the adding of items to the other end but the list ADT does not. The list ADT supports the printing of the list contents but the queue ADT does not.

The list ADT supports the printing of the list contents but the queue ADT does not.

In a computational problem for finding the highest salary of an employee in a company, what is the input?

The list of employees' salaries

AVL is named for inventors Adelson-Velsky and Landis, who described the data structure in a 1962 paper: "An Algorithm for the Organization of Information", often cited as the first balanced tree structure.

True

An AVL tree is height balanced: For any node, left and right subtree heights differ by only 0 or 1.

True

Every AVL tree node's balance factor (left minus right heights) is -1, 0, or 1.

True

Minimizing binary tree height yields fastest searches, insertions, and removals.

True

What values are stored in the list numList? numberList() { for (i = 0; i < 10; i++) { if (i % 2 == 0) { numList[i] = I } } }

[0, 2, 4, 6, 8]

ADTs allow programmers to _____.

focus on higher-level operations as per a program's needs

A perfect hash function _____.

maps items to buckets with no collisions

During insertions, if the bucket is occupied, iterating over i values to determine next empty bucket is called ___.

probing sequence

If a queue is implemented as a linked list, a dequeue removes _____ node.

the head

The worst-case runtime of an algorithm is _____ number of steps taken to execute a program.

the maximum

During sorting the algorithm swaps _____.

two elements at a time


Kaugnay na mga set ng pag-aaral

bio 182 lab 7: Mollusca and Annelida

View Set

Chapter 15 Autonomic Nervous System

View Set

Econ 2301 Ch. 7 Midterm Review Lee College Mrs. Kar

View Set