ds ex.2

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

Given hash function of key % 5, determine the insert location for item 34. Assume there are items 72, 84, and 25 are already in table and linear probing is using to solve the colilision. The location for 34 will be bucket __________

1

A class has 100 students. Student ID numbers range from 1000 to 9999. Using the ID number as key, how many buckets will a direct access table require?

10000

Starts with an empty list. After the following actions, what the list is? Append(list, 3) Append(list, 2) Append(list, 1) Remove(list, 3) 1, 2 2, 1 3, 2, 1 1, 2, 3

2, 1

Starts with an empty list. After the following actions, what the list is? Append(list, 3) Append(list, 2) Append(list, 1) Remove(list, 2) 1, 3 3, 2, 1 3, 1 3

3, 1

Starts with an empty list. After the following actions, what the list is? Append(list, 3) Append(list, 2) Append(list, 1) Remove(list, 2) Append(list, 3) 3 3, 1, 3 3, 3, 1 2, 1, 3

3, 1, 3

Consider the following table 3 blank 4 34 HashRemove(idsTable, 10) probes _____ buckets.

4

Given a list with nodes 40, 888, -3, 2, what does GetLength(list) return?

4

Given a hash table with 100 buckets and modulo hash function, in which bucket will HashInsert(table, item 258) insert item 258?

58

Given single linked list: head->76->45->68->97->null. Appending node 35 to the list, which node's next pointer is updated?

97

Given charList head->A->X->K->null. ListRemoveAfter(charList, node A) executes the statement list->tail = curNode. Assume that ListRemoveAfter is declared as ListRemoveAfter(list, curNode). It remove a node after the curNode. If curNode is null, it removes the list head. In algorithm, sucNode points to the node after removed node in original list.

False

If a list ADT has operations like Sort or PrintReverse, the list is clearly implemented using an array.

False

Queue is FILO (First in, last out) data structure

False

Given a list with nodes 'Z', 'A', 'B', 'C', Sort(list) yields 'A', 'B', 'C', 'Z'.

True

Given charList head->A->X->K->null. ListRemoveAfter(charList, node X) executes the statement list->tail = curNode. Assume that ListRemoveAfter is declared as ListRemoveAfter(list, curNode). It remove a node after the curNode. If curNode is null, it removes the list head. In algorithm, sucNode points to the node after removed node in original list.

True

Given charList head->A->X->K->null. ListRemoveAfter(charList, null) executes the statement sucNode = list->head->next. Assume that ListRemoveAfter is declared as ListRemoveAfter(list, curNode). It remove a node after the curNode. If curNode is null, it removes the list head. In algorithm, sucNode points to the node after removed node in original list.

True

Stack is FILO (First in, Last out) data structure

True

Given charList head->C->T->L->null, ListInsertAfter(charList, node L, node Q) will execute which statement? Note: The book's algorithm ListInsertAfter is declared as ListInsertAfter(list, curNode, newNode) list->head = newNode list->tail = null list->tail->next = newNode None of the above

list->tail->next = newNode

Given hash function of key % 10, determine the bucket status after the following operations have been executed. HashInsert(valsTable, item 68)HashInsert(valsTable, item 25)HashInsert(valsTable, item 50)HashRemove(valsTable, 50) Bucket 5 is _______ (Type in empty or not empty)

not empty

Assume the stack is implemented using a linked list. An empty stack is indicated by a list head pointer value of _____.

null


Kaugnay na mga set ng pag-aaral

APUSH- Unit 3- Forming New Nation: Articles of Confederation

View Set

Civil liberties and Civil rights AP Govt.

View Set

group polarization chapter 8 part one

View Set

Types of Life Policies Chapter 2

View Set

Relative Pronouns: Qui, Que, Dont, Où

View Set

Managerial Accounting Test 1 Chapter 4

View Set

Latin American Government & Politics Final Exam 2016 (II)

View Set