CSCI251 - Exam 2 Study Guide

Ace your homework & exams now with Quizwiz!

MD5 produces larger hash values for larger input data sizes. True False

False //always 128-bit has values

A hash table's items will be positive integers, and -1 will represent empty. A 5-bucket hash table is: -1, -1, 72, 93, -1. How many items are in the table? 0 2 5

2

Given numStack: 41, 8 (top is 41) What is the stack after the following operations? Type the stack as: 1, 2, 3 Pop(numStack) Push(numStack, 2) Push(numStack, 15) Pop(numStack)

2, 8

numsList: 2, 8, 1 ListRemove(numsList, list tail) numsList:

2, 8

Given callStack: 2, 9, 4What are the contents of the stack after Peek(callStack)? 2, 9, 4 9, 4

2, 9, 4 (Peek only looks at the top of the stack)

How many direct access table buckets are needed for items with keys ranging from 100 to 200 (inclusive)?

201 //200 + 1. The hash table's size equals the largest key value plus 1, which may be very large.

numList = new List ListAppend(numList, node 23) ListAppend(numList, node 96) ListAppend(numList, node 76) ListAppend(numList, node 19) numList is now: Which node has a null previous pointer? Which node has a null next pointer?

23, 96, 76, 19 23 19

Given numStack: 24, 14 (top is 24) What does Peek(numStack) return? What is the stack after the following operations? Push(numStack, 87) Pop(numStack) Peek(numStack) Peek(numStack) Push(numStack, 86) Pop(numStack) After the above operations, what does GetLength(numStack) return?

24 24, 14 2

numList = new List ListAppend(numList, node 53) ListPrepend(numList, node 87) ListPrepend(numList, node 24) ListAppend(numList, node 92) numList is now: Which node has a null next pointer? Which node has a null previous pointer?

24, 87, 53, 92 92 24

If the Caeser cipher were implemented such that strings were restricted to only lower-case alphabet characters, how many distinct ways could a message be encrypted? 26 52 Length of the message

26

For a binary mid-square hash function, how many bits are needed for an 80 entry hash table?

7 //80 in binary is 1010000 which is 7 bits. Thus 7 bits are needed for an 80 entry has table

numsList: 70, 82, 41, 120, 357, 66 ListRemove(numsList, node 82) ListRemove(numsList, node 357) ListRemove(numsList, node 66) numsList:

70, 41, 120

numsList: 71, 29, 54 ListRemove(numsList, node 29) numsList:

71, 54

Suppose numbersList is a singly-linked list with items 73, 19, and 86. Item 86 is at the list's tail. 1) What is the list's contents after the following operations?lastItem = numbersList⇢tailListAppend(numbersList, node 25)ListInsertAfter(numbersList, lastItem, node 49) 73, 19, 86, 25, 49 73, 19, 86, 49, 25 73, 19, 25, 49, 86

73, 19, 86, 49, 25

For a 1000-entry direct access table, type the bucket number for the inserted item, or type: None HashInsert(hashIndex, item 734)

734

numList = new List ListPrepend(numList, node 75) ListAppend(numList, node 88) numList is now:

75, 88

numsList: 77 ListInsertAfter(numsList, node 77, node 32) ListInsertAfter(numsList, node 32, node 50) ListInsertAfter(numsList, node 32, node 46) numsList:

77, 32, 46, 50

numList = new List ListAppend(numList, node 78) ListAppend(numList, node 89) ListAppend(numList, node 52) ListAppend(numList, node 87) numList is now:

78, 89, 52, 87

Given numQueue: 79, 21, 67, 86 What does the list head pointer point to? If the pointer is null, enter null. After the following operations: QueueEnqueue(numQueue, 46) QueueDequeue(numQueue) QueueEnqueue(numQueue, 18) QueueDequeue(numQueue) What does the list head pointer point to? What does the list tail pointer point to?

79 86 67 18

Given numQueue: 4, 8, 7, 1, 3 What is returned by the second dequeue operation? Dequeue(numQueue) Dequeue(numQueue)

8

Given numQueue: 15, 91, 11 What is the queue after the following dequeue operation? Dequeue(numQueue)

91, 11

numList = new List ListInsertAfter(numList, list head, node 92) ListInsertAfter(numList, list tail, node 11) ListInsertAfter(numList, list tail, node 43) numList is now: What node does node 11's next pointer point to? What node does node 11's previous pointer point to?

92, 11, 43 node 43 node 92

Given numQueue: 96, 20 What does Peek(numQueue) return? What is the queue after the following operations? Peek(numQueue) Enqueue(numQueue, 69) Enqueue(numQueue, 72) Dequeue(numQueue) After the above operations, what does GetLength(numQueue) return?

96 20, 69, 72 3

Given an empty deque numDeque, what are the deque's contents after the following operations? PushFront(numDeque, 97) PushBack(numDeque, 80) After the above operations, what does PeekFront(numDeque) return?After the above operations, what does PeekBack(numDeque) return?After the above operations, what does GetLength(numDeque) return?

97, 80 97 80 2

key % 1000 maps to indices 0 to ____.

999

Given numQueue: 42, 30 Dequeue(numQueue) Peek(numQueue) After the above operations, what does GetLength(numQueue) return? After the above operations, what does IsEmpty(numQueue) return?

1 false

numsList: 23, 17, 8 ListInsertAfter(numsList, node 23, node 5) numsList:

23, 5, 17, 8

numList: 25, 89 ListInsertAfter(numList, node 25, node 72) ListInsertAfter(numList, node 72, node 86) ListInsertAfter(numList, node 72, node 78) numList is now:

25, 72, 78, 86, 89

For a decimal mid-square hash function, what is the bucket index for key = 112, N = 1000, and R = 3?

254

Given list: 8, 3, 4, 6, 7 What list results from the following operations? ListRemove(list, node 8) ListRemove(list, node 7) ListRemove(list, node 4) List items in order, from head to tail.

3, 6

Given numStack: 76, 75 (top is 76) What is the stack after the following operations? Pop(numStack) Push(numStack, 33) After the above operations, what does GetLength(numStack) return?

33, 75 2

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

34

42 is appended to an array-based list with allocationSize = 8 and length = 4. Appending assigns the array at index _____ with 42. 4 8

4

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

4

Given inventoryStack: 70, 888, -3, 2What does GetLength(inventoryStack) return? 4 70

4 (GetLength returns the number of items in the stack)

Given numStack: 34, 20 (top is 34) Type the stack after the following two push operations. Type the stack as: 1, 2, 3 Push(numStack, 11) Push(numStack, 4)

4, 11, 34, 20

Given jobsDeque: 4, 7, 5, what are the deque contents after PeekBack(jobsDeque)? 4, 7, 5 4, 7

4, 7, 5

numList = new List ListPrepend(numList, node 56) ListPrepend(numList, node 29) ListPrepend(numList, node 41) ListPrepend(numList, node 40) numList is now: Which node has a null previous pointer? Which node has a null next pointer? Ex: 5

40, 41, 29, 56 40 56

Given numQueue: 87, 21, 43 What are the queue's contents after the following operations? Dequeue(numQueue) Enqueue(numQueue, 6) Enqueue(numQueue, 50) Dequeue(numQueue)

43, 6, 50

Given numStack: 7, 5 (top is 7). Type the stack after the following push operation. Type the stack as: 1, 2, 3 Push(numStack, 8)

8, 7, 5

Given list: 2, 8, 3, 9, 4 What list results from the following operations? ListRemoveAfter(list, node 8) ListRemoveAfter(list, null) ListRemoveAfter(list, node 9) List items in order, from head to tail.

8, 9

numsList: 91, 80, 77, 60, 75 ListRemoveAfter(numsList, node 60) ListRemoveAfter(numsList, node 77) ListRemoveAfter(numsList, null) numsList:

80, 77 (when it is null, the head node is removed)

Given numStack: 2, 9, 5, 8, 1, 3 (top is 2). What is returned by the second pop operation? Pop(numStack) Pop(numStack)

9

Given numStack: 5, 9, 1 (top is 5) What is the stack after the following pop operation? Type the stack as: 1, 2, 3 Pop(numStack)

9, 1

Given callStack: 2, 9, 4What are the contents of the stack after Pop(callStack)? 2, 9, 4 9, 4

9, 4

Given parkingQueue: 2, 9, 4, what are the contents of the queue after Dequeue(parkingQueue)? 9, 4 2, 9, 4

9, 4

numsList: 9, 4, 11, 7 ListRemoveAfter(numsList, node 11) numsList:

9, 4, 11

What aspect of linked lists makes adapting array-based sorting algorithms to linked lists difficult? Two elements in a linked list cannot be swapped in constant time Nodes in a linked list cannot be moved Elements in a linked list cannot be accessed by index

Elements in a linked list cannot be accessed by index

A company will store all employees in a hash table. Each employee item consists of a name, department, and employee ID number. Which is the most appropriate key? Name Department Employee ID number

Employee ID number

Encryption and decryption are synonymous. True False

False

If the hash table was using open addressing, a load factor > 0.9 guarantees a collision during insertion. True False

False

Prepending node 789 to studentIdList updates the list's tail pointer. True False

False (prepending updates the head pointer, not the tail pointer)

ListTraverseReverse can be used to traverse a singly-linked list. True False

False (this can only be used to traverse a doubly-linked list)

If computer B in the above example computed a hash value identical to the downloaded hash value, then the downloaded message would be guaranteed to be uncorrupted. True False

False //High chance of uncorrupted data, but still a possibility

When the removal algorithm finds the bucket containing the key to be removed, the bucket is marked as empty-since-start. True False

False //It's marked empty-after-removal

What is the result of applying the Caeser cipher with a left shift of 1 to the string "computer"? eqorwvgt dpnqvufs bnlotsdq

bnlotsdq

A 100 element hash table has 100 _____. items buckets

buckets

ListInsertAfter(list, null, newNode) will insert newNode before the list's dummy node. True False

false

Removing at index 0 yields the best case runtime for remove-at. True False

false

The length of an array-based list equals the list's array allocation size. True False

false

An array-based list can have a default allocation size of 0. True False

false ( the default allocation size must be >= 1)

Given numsList is: 5, 8, 2, 1. ListTraverse(numsList) visits _____ node(s). one two four

four (traverses visit ALL the elements in a list)

Assume the queue is implemented using a linked list. 1) If the head pointer is null, the queue _____. is empty is full has at least one item 2) For the operation QueueDequeue(queue), what is the second parameter passed to ListRemoveAfter? The list's head node The list's tail node null 3) For the operation QueueDequeue(queue), headData is assigned with the list _____ node's data. head tail

is empty null head

Which operation determines if the queue contains no items? IsEmpty Peek

isEmpty

A hash function computes a bucket index from an item's _____. integer value key

key

Suppose dataList is a singly-linked list with a dummy node. Which is a requirement of the ListPrepend function? The list is empty The list is not empty newNode is not null

newNode is not null

Given list: 2, 1, 6, 3 Select the value of the list's head pointer after each operation. ListRemoveAfter(list, node 1) ListRemoveAfter(list, null) ListRemoveAfter(list, node 1) ListRemoveAfter(list, null)

node 2 (2, 1, 3 are left) node 1 (1, 3 are left) node 1 (1 is left) null (since the last node is removed, the head pointer is now null)

Given list: 9, 2, 3, 4 Select the value of sucNode during each operation. ListRemove(list, node 2) ListRemove(list, node 9) ListRemove(list, node 4) ListRemove(list, node 3)

node 3 (9, 3 4) node 3 (3, 4) null (3) null

Searching for a key that is not in the list yields the worst case runtime for search. True False

true

Neither search nor remove-at will resize the list's array. true false

true (prepend, append, and insert-after operations may resize a list's array, but search and remove do not)

Given that jobsDeque is empty, what does GetLength(jobsDeque) return? -1 0 Undefined

0

Given that parkingQueue has no items (i.e., is empty), what does GetLength(parkingQueue) return? -1 0 Undefined

0

Given a hash table with 50 buckets and modulo hash function, in which bucket will HashSearch(table, 201) search for the item?

1

Type the list after the given operations. Each question starts with an empty list. Type the list as: 5, 7, 9 1) Append(list, 3) Append(list, 2) 2) Append(list, 3) Append(list, 2) Append(list, 1) Remove(list, 3) 3) After the following operations, will Search(list, 2) find an item? Type yes or no. Append(list, 3) Append(list, 2) Append(list, 1) Remove(list, 2)

1) 3, 2 2) 2, 1 3) No

numsList: 1 ListInsertAfter(numsList, node 1, node 6) ListInsertAfter(numsList, node 1, node 4) numsList:

1, 4, 6

Given parkingQueue: 1, 8, 3, what are the queue contents after Peek(parkingQueue)? 1, 8, 3 8, 3

1, 8, 3

A modulo hash function is used to map to indices 0 to 9. The hash function should be: key % _____

10

For a decimal mid-square hash function, what is the bucket index for key = 110, N = 200, and R = 3?

10

numsList: 10, 20, 30, 40, 50, 60 ListRemoveAfter(numsList, node 40) ListRemoveAfter(numsList, node 20) numsList:

10, 20, 40, 60

Given an empty deque numDeque, what are the deque's contents after the following operations? PushFront(numDeque, 36) PopBack(numDeque) PushBack(numDeque, 10) PushFront(numDeque, 42) PushBack(numDeque, 98) PopFront(numDeque) After the above operations, what does GetLength(numDeque) return?

10, 98 2

For R = 3, what are the middle bits for a key of 9? 9 * 9 = 81; 81 in binary is 1010001.

100

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

100000 //99999 + 1. The hash table's size equals the largest key value plus 1, which may be very large.

If ListTraverse is called to traverse a list with 10 nodes, how many calls to ListTraverseRecursive are made? 9 10 11

11

numsList: 2, 5, 9 ListRemoveAfter(numsList, node 5) numsList:

2, 5

numList: 46, 73 ListInsertAfter(numList, node 73, node 24) ListInsertAfter(numList, node 24, node 34) ListInsertAfter(numList, node 34, node 19) ListInsertAfter(numList, node 34, node 16) numList is now: What node does node 46's next pointer point to? What node does node 46's previous pointer point to?

46, 73, 24, 34, 16, 19 node 73 null

Given numQueue: 49, 3, 8 What is returned by the following dequeue operation? Dequeue(numQueue)

49

numList = new ListListInsertAfter(numList, list head, node 49) ListInsertAfter(numList, list tail, node 76) ListInsertAfter(numList, list tail, node 58) numList is now:

49, 76, 58

Given numStack: 5, 9, 1 (top is 5) What is returned by the following pop operation? Pop(numStack)

5

An empty hash table hashTable has 5 buckets and a hash function of key % 5. The following operations are performed in order. Select which operations cause a collision. HashInsert(hashTable, 13) HashInsert(hashTable, 3) HashInsert(hashTable, 18) HashInsert(hashTable, 8) HashInsert(hashTable, 1)

HashInsert(hashTable, 3) HashInsert(hashTable, 18) HashInsert(hashTable, 8)

Which operation determines if the deque contains no items? IsEmpty PeekFront

IsEmpty

Which operation determines if the stack contains no items? Peek IsEmpty

IsEmpty

A hash table has buckets 0 to 9 and uses a hash function of key % 10. If the table is initially empty and the following inserts are applied in the order shown, the insert of which item results in a collision?HashInsert(hashTable, item 55)HashInsert(hashTable, item 90)HashInsert(hashTable, item 95) Item 55 Item 90 Item 95

Item 95

Suppose dataList is a singly-linked list with a dummy node. 1) Which statement removes the first item from the list? ListRemoveAfter(dataList, null) ListRemoveAfter(dataList, dataList⇢head) ListRemoveAfter(dataList, dataList⇢tail)

ListRemoveAfter(dataList, dataList⇢head)

Suppose numbersList is a singly-linked list with items 73, 19, and 86. Item 86 is at the list's tail. 2) Suppose the following statement is executed:node19 = numbersList⇢head⇢next⇢nextWhich subsequent operations swap nodes 73 and 19? ListPrepend(numbersList, node19) ListInsertAfter(numbersList, numbersList⇢head, node19) ListRemoveAfter(numbersList, numbersList⇢head⇢next) ListPrepend(numbersList, node19)

ListRemoveAfter(numbersList, numbersList⇢head⇢next) ListPrepend(numbersList, node19)

Will the hash function and expected key likely work well for the following scenarios? 1) Hash function: key % 1000 Key: 6-digit employee ID Hash table size: 20000 Yes No 2) Hash function: key % 250 Key: 5-digit customer ID Hash table size: 250 Yes No 3) Hash function: key % 1000 Key: Selling price of a house. Hash table size: 1000 Yes No 4) Hash function: key % 40 Key: 4-digit even numbers Hash table size: 40 Yes No 5) Hash function: key % 1000 Key: Customer's 3-digit U.S. phone number area code, of which about 300 exist. Hash table size: 1000 Yes No

No //A good hash function should uniformly distribute hashed keys across all buckets (20,000), not just the first 1,000 buckets Yes No //The selling price of a house is usually rounded to the nearest 1000, thus a lot of the prices will be in bucket 0 No //Since the hash table size is even, dividing the key by it is merely going to produce another even number which will cause them to only map to even buckets. No //Hundreds of customers will have the same area code, and only a 1/3 of the bucket will actually be used

For a 1000-entry direct access table, type the bucket number for the inserted item, or type: None HashInsert(hashIndex, item -45)

None //Must be 0 or a positive number

For a 1000-entry direct access table, type the bucket number for the inserted item, or type: None HashInsert(hashIndex, item 1034)

None //the largest size is 999

For a well-designed hash table, searching requires _____ on average. O(1) O(N) O(log N)

O(1)

Which operation should usually be preceded by a check that the stack is not empty? Pop Push

Pop (If it is an empty stack and Pop is implemented, the result is undefined)

Which sorting algorithm uses a gap value to jump between elements, and is difficult to adapt to linked lists for this reason? insertion sort Merge sort Shell sort

Shell sort

Why are sorting algorithms for arrays generally more difficult to adapt to singly-linked lists than to doubly-linked lists? Singly-linked lists do not support backward traversal Singly-linked do not support inserting nodes at arbitrary locations

Singly-linked lists do not support backward traversal

Prepending C to gradesList updates which pointer?

The list's head pointer

Cryptography is used heavily in internet communications. True False

True

Double hashing would never resolve collisions if the second hash function always returned 0. True False

True

Given a list with items 'Z', 'A', 'B', Sort(list) yields 'A', 'B', 'Z'. True False

True

If the hash table was using chaining, the load factor could be ≤ 0.1, but an individual bucket could still contain 10 items. True False

True

If the hash table was using open addressing, a load factor < 0.25 guarantees that no more than 25 collisions will occur during insertion. True False

True

ListTraverseRecursive works for an empty list. True False

True

ListTraverseRecursive works for both singly-linked and doubly-linked lists. True False

True

The dummy node's next pointer points to the first list item. True False

True

The removal algorithm searches for the bucket containing the key to remove. If found, the bucket is marked as empty-after-removal. True False

True

When resizing to a larger size, the load factor is guaranteed to decrease. True False

True

ListTraverse can be used to traverse a doubly-linked list. true false

True (traverses can be used for either a doubly or singly linked list)

in a hash table using open addressing, the load factor cannot exceed 1.0. True False

True //Yes, only one item per bucket

For each question, assume 2 list types are available: a doubly-linked list with 1 dummy node at the list's head, and a doubly-linked list with 2 dummy nodes, one at the head and the other at the tail. 1) When list⇢head == list⇢tail is true in _____, the list is empty. a list with 1 dummy node a list with 2 dummy nodes either a list with 1 dummy node or a list with 2 dummy nodes 2) list⇢tail may be null in _____. a list with 1 dummy node a list with 2 dummy nodes neither list type 3) list⇢head⇢next is always non-null in _____. a list with 1 dummy node a list with 2 dummy nodes neither list type

a list with 1 dummy node neither list type a list with 2 dummy nodes

Given list: 5, 9, 7, 6 Select the value of sucNode after each operation. ListRemoveAfter(list, node 9) ListRemoveAfter(list, null) ListRemoveAfter(list, node 9) ListRemoveAfter(list, null)

node 6 (5, 9, 6) node 9 (9, 6) null (9) null (since the last node is removed, the next node of the list is always null; thus it is still null)

Given list: 5, 4, 7, 8 Select the value of the list's tail pointer after each operation. ListRemoveAfter(list, node 5) ListRemoveAfter(list, null) ListRemoveAfter(list, node 7) ListRemoveAfter(list, null)

node 8 (5, 7, 8) node 8 (7, 8) node 7 (7) null (since the last node is removed, the head pointer is now null)

Given list: 9, 6, 3, 8 Select the value of the list's head pointer after each operation. ListRemove(list, node 3) ListRemove(list, node 9) ListRemove(list, node 8) ListRemove(list, node 6)

node 9 (9, 6, 8) node 6 (6, 8) node 6 (6) null

Assume the stack is implemented using a linked list. 1) An empty stack is indicated by a list head pointer value of _____. newNode null Unknown 2) StackPop returns list's head node. True False

null False (StackPop returns a list's head node's DATA, not the head node itself)

Given an empty stack numStack, what does the list head pointer point to? If the pointer is null, enter null. After the following operation, which node does the list head pointer point to? StackPush(numStack, 98)

null 98

Given an empty queue numQueue, what does the list head pointer point to? If the pointer is null, enter null. What does the list tail pointer point to? After the following operations: QueueEnqueue(numQueue, 49) QueueEnqueue(numQueue, 36) QueueEnqueue(numQueue, 48) QueueDequeue(numQueue) What does the list head pointer point to? What does the list tail pointer point to?

null null 36 48

Given numQueue is empty, what does the list head pointer point to? What does the list tail pointer point to? After the following operations: Enqueue(numQueue, 71) Enqueue(numQueue, 92) Enqueue(numQueue, 72) Dequeue(numQueue) What does the list head pointer point to? What does the list tail pointer point to?

null null 92 72

If a message is encrypted with a left shift of X, what shift is needed to decrypt? left shift of X right shift of X

right shift of X

Suppose a linked list has 10 nodes. 1) When more than 1 of the list's nodes contains the search key, ListSearch returns _____ node containing the key. the first the last a random Correct The list is searched from the head in forward order. The first node containing the key is returned. 2) Calling ListSearch results in a minimum of _____ calls to ListSearchRecursive. 1 2 10 11 3) When the key is not found, ListSearch returns _____. the list's head the list's tail null

the first 1 null

Given numStack: 86, 92 (top is 86) Pop(numStack) Peek(numStack) After the above operations, what does GetLength(numStack) return? After the above operations, what does IsEmpty(numStack) return?

1 false

Given numDeque: 68, 24 PopBack(numDeque) PeekFront(numDeque) After the above operations, what does GetLength(numDeque) return? After the above operations, what does IsEmpty(numDeque) return?

1 false

Given numQueue: 11, 22 (the front is 11) What are the queue contents after the following enqueue operations? Enqueue(numQueue, 28) Enqueue(numQueue, 72)

11, 22, 28, 72

Given weeklySalesList: 12, 30 Show the node order after the following operations: ListInsertAfter(weeklySalesList, list tail, node 8) ListInsertAfter(weeklySalesList, list head, node 45) ListInsertAfter(weeklySalesList, node 45, node 76)

12, 45, 76, 30, 8 AKA POSITION 0 (head node): node 12 POSITION 1: node 45 POSITION 2: node 76 POSITION 3: node 30 POSITION 4 (tail node): node 8

numList = new ListListInsertAfter(numList, list head, node 12) ListInsertAfter(numList, list tail, node 90) ListInsertAfter(numList, list tail, node 67) ListInsertAfter(numList, node 12, node 57) numList is now:

12, 57, 90, 67

Given numQueue: 47, 12 What are the queue's contents after the following operations? Dequeue(numQueue) Enqueue(numQueue, 67) Enqueue(numQueue, 59) After the above operations, what does GetLength(numQueue) return?

12, 67, 59 3

A hash table with non-negative integer keys has a modulo hash function of key % 15. Hash function index range: 0 to Item 186 will go in bucket ___

14 6

Given rosterQueue: 400, 313, 270, 514, 119, what does GetLength(rosterQueue) return? 400 5

5

Given numQueue: 5, 9, 1 (front is 5) What are the queue contents after the following enqueue operation? Type the queue as: 1, 2, 3 Enqueue(numQueue, 4)

5, 9, 1, 4

numsList: 5, 9 ListInsertAfter(numsList, node 9, node 4) numsList:

5, 9, 4

A modulo hash function for a 50 entry hash table is: key % _____

50

Given numStack: 50, 39, 32 (top is 50) After the following operation: StackPop(numStack) What is returned? What node does the list's head pointer point to? If the pointer is null, enter null.

50 39

numList = new List ListInsertAfter(numList, list head, node 50) ListInsertAfter(numList, list tail, node 83) ListInsertAfter(numList, list tail, node 73) ListInsertAfter(numList, node 50, node 71) numList is now: What node does node 83's next pointer point to? What node does node 83's previous pointer point to?

50, 71, 83, 73 node 73 node 71

numsList: 3, 57, 28, 40 ListRemoveAfter(numsList, null) numsList:

57, 28, 40 (when it is null, the head node is removed)

numList = new List ListPrepend(numList, node 66) ListPrepend(numList, node 27) ListPrepend(numList, node 95) ListPrepend(numList, node 57) numList is now:

57, 95, 27, 66

Given rosterDeque: 351, 814, 216, 636, 484, 102, what does GetLength(rosterDeque) return? 351 102 6

6

An ordinary array contains items with keys: 2, 31, 7, 16, 4, 39 A hash table has 10 buckets with hash function key % 10. The hash table contains the same items as the array. How many elements are checked when searching for each of the following items? Item Array Hash Table 36 ______ _____ 39 ______ _____ 7 ______ _____

6 1 6 1 3 1

Given jobsDeque: 3, 6, 1, 7, what are the contents of the deque after PopFront(jobsDeque)? 6, 1, 7 3, 6, 1, 7

6, 1, 7

For a decimal mid-square hash function, what are the middle digits for key = 40, N = 100, and R = 2?

60

Given numStack: 63, 46, 25 (top is 63) After the following operation: StackPush(numStack, 98) What node does newNode's next pointer point to? If the pointer is null, enter null. What node does the list's head pointer point to?

63 98

Which is not an advantage of storing password hash values, instead of actual passwords, in a database? Database administrators cannot see users' passwords. Database storage space is saved. Attackers who gain access to database contents still may not be able to determine users' passwords.

Database storage space is saved.

A hash table implementation must use only one criteria for resizing. True False

False

A hash value can be used to reconstruct the original data. True False

False

In a hash table using chaining, the load factor cannot exceed 1.0. True False

False

The head and tail pointers always point to the dummy node. True False

False

The insertion algorithm can only insert into empty-since-start buckets. True False

False

The search algorithm stops only when encountering a bucket containing the key being searched for. True False

False

When a hash table is initialized, all entries must be empty-after-removal. True False

False

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

False (We should not know what the implementation is for ADTs)

The Caeser cipher is an encryption algorithm that works well to secure data for modern digital communications. True False

False //It's too easy to decrypt

If myList is a singly-linked list with a dummy node, which statement is true when the list is empty? myList⇢head == null myList⇢tail == null myList⇢head == myList⇢tail

myList⇢head == myList⇢tail (If there were no dummy node, then the first two answers would be correct instead, but having a dummy node means that the head or tail will never be null)

Given list: 8, 9, 1, 5 Select the value of the list's tail pointer after each operation. ListRemove(list, node 9) ListRemove(list, node 8) ListRemove(list, node 5) ListRemove(list, node 1)

node 5 (8, 1, 5) node 5 (1, 5) node 1 (1) null

ListTraverse begins with _____. a specified list node the list's head node the list's tail node

the list's head node

A user could login with an incorrect password if a password hashing function produced the same hash value for two different passwords. True False

true

Generating and storing random data alongside each password hash in a database, and using (password + random_data) to generate the hash value, can help increase security. True False

true

ListPrepend(list, newNode) is equivalent to ListInsertAfter(list, list⇢head, newNode). True False

true

ListRemove's implementation must not allow removal of the dummy node. True False

true


Related study sets

Cardiovascular (Dysrhythmias, MI) Critical Care

View Set

UNCC BIOL3111 Exam 3 Chapter 6 Study Questions

View Set

Ch 31 Pre and Closing Cost Issues

View Set