Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

Sacramento City College CISP 430/ CISP430 Midterm Exam | Quiz Score: 150 out of 150 | Latest 2025/26.

Rating
-
Sold
-
Pages
63
Grade
A+
Uploaded on
12-02-2026
Written in
2025/2026

Sacramento City College CISP 430/ CISP430 Midterm Exam | Quiz Score: 150 out of 150 | Latest 2025/26. ListPrepend(myList, node 75) ListInsert(myList, node 76) ListInsert(myList, node 68) ListPrepend(myList, node 75) ListPrepend(myList, node 76) ListPrepend(myList, node 68)  Question 3 1 / 1 pts the list's head pointer is null the newNode argument is also null the list has more than 2 items the list's head and tail pointers point to different nodes  Question 4 1 / 1 pts ListInsertAfter(list, node 22) ListInsertAfter(list, node 55) ListInsertAfter(list, node 11, node 22) ListInsertAfter(list, node 44, node 55) ListInsertAfter(list, node 11, node 22, node 55) ListInsertAfter(list, node 0, node 22) ListInsertAfter(list, node 3, node 55)  Question 5 1 / 1 pts In the ListInsertAfter function for singly-linked lists, the curNode parameter is ignored when _____. Given the singly-linked list (11, 33, 44, 66), identify the commands for inserting 22 and 55, such that the final list is (11, 22, 33, 44, 55, 66). Which XXX completes the following algorithm for inserting a new node into a singly-linked list? This study source was downloaded by from CourseH on :39:11 GMT -06:00 newNode⇢next = curNode⇢next curNode⇢next = newNode newNode⇢next = curNode⇢next curNode = newNode newNode⇢next = null curNode⇢next = list⇢tail⇢next newNode⇢next = curNode⇢next curNode⇢next = null  Question 6 1 / 1 pts The head node The list will be removed. The tail node No node will be removed.  ListInsertAfter(list, curNode, newNode) { if (list⇢head == null) { list⇢head = newNode list⇢tail = newNode } else if (curNode == list⇢tail) { list⇢tail⇢next = newNode list⇢tail = newNode } else { XXX } } Given the singly-linked list (88, 99), which node will be removed by the ListRemoveAfter(list, node 88) command? This study source was downloaded by from CourseH on :39:11 GMT -06:00 Question 7 1 / 1 pts ListRemoveAfter(list, null) ListRemoveAfter(list, node 20) ListRemoveAfter(list, node 60) ListRemoveAfter(list, null) ListRemoveAfter(list, node 10) ListRemoveAfter(list, node 50) ListRemoveAfter(list, null) ListRemoveAfter(list, null) ListRemoveAfter(list, node 50) ListRemoveAfter(list, null) ListRemoveAfter(list, null) ListRemoveAfter(list, node 60)  Question 8 1 / 1 pts Given the singly-linked list (10, 20, 30, 40, 50, 60), what commands remove 10, 20, and 60, such that the final list is (30, 40, 50)? Which XXX completes the algorithm to remove a node from the singly-linked list? ListRemoveAfter(list, curNode) { if (curNode is null && list⇢head is not null) { sucNode = list⇢head⇢next list⇢head = sucNode if (sucNode is null) { XXX } } else if (curNode⇢next is not null) { sucNode = curNode⇢next⇢next curNode⇢next = sucNode if (sucNode is null) { list⇢tail = curNode } This study source was downloaded by from CourseH on :39:11 GMT -06:00 list⇢tail = null list⇢head = sucNode sucNode = list⇢head⇢next list⇢tail = curNode  Question 9 1 / 1 pts 1 Node 80 Null True  Question 10 1 / 1 pts node 10 node 40 node 20 node 30  Question 11 1 / 1 pts all the nodes only the first and last nodes only the last node only the first node  Question 12 1 / 1 pts } } Given the singly-linked list (80, 81, 82, 83), what is returned from ListSearch(list, 84)? Given the singly-linked list (10, 20, 30, 40, 50, 60), ListSearch(list, 30) points the current node pointer to _____ after checking node 20. ListSearch visits _____ when searching for 83 in the singly-linked list (80, 81, 82, 83). This study source was downloaded by from CourseH on :39:11 GMT -06:00 Powered by TCPDF () The while condition should be while (curNode is not null) . The statement curNode = students⇢head should be curNode = students⇢tail . The statement curNode = curNode⇢next should be curNode = students⇢head . The if condition should be if (curNode⇢data != key) .  Question 13 1 / 1 pts node 3 and null the head and node 3 null node 3  Question 14 1 / 1 pts Identify the error in the following algorithm to search for a node in the singly-linked list of students. ListSearch(students, key) { curNode = students⇢head while (curNode is null) { if (curNode⇢data == key) { return curNode } curNode = curNode⇢next } return null } Given a doubly-linked list (2, 3, 4, 5, 6, 7), node 2's pointer(s) point(s) to _____. Which representation is correct for a doubly-linked list with 2 nodes? This study source was downloaded by from CourseH on :39:55 GMT -06:00  Question 15 1 / 1 pts the head null node Tom node Hal  Question 16 1 / 1 pts newNode⇢next = list⇢tail list⇢head⇢next = newNode Given the following doubly-linked list, what is node Hal's previous pointer value after ListPrepend(students, node Hal) is executed? Which XXX would replace the missing statements in the following code to prepend a node in a doublylinked list? ListPrepend(students, newNode) { if (list⇢head == null) { list⇢head = newNode list⇢tail = newNode } else { XXX list⇢head = newNode } } This study source was downloaded by from CourseH on :39:55 GMT -06:00 newNode⇢head = list⇢next list⇢head⇢prev = newNode newNode⇢next = list⇢head list⇢head⇢next = newNode newNode⇢next = list⇢head list⇢head⇢prev = newNode  Question 17 1 / 1 pts Pam Tom Hal Sam  Question 18 1 / 1 pts Tom Tim Sam Pam  Given the doubly-linked list students (Tom, Sam), what will be the second node in the list after the following operations? ListInsertAfter(students, list⇢tail, node Hal) ListInsertAfter(students, list⇢head, node Pam) Given the doubly-linked list students (Tom, Sam, Hal, Pam), what is the student list's head node after the operation ListInsertAfter(students, node Tom, node Tim)? This study source was downloaded by from CourseH on :39:55 GMT -06:00 Question 19 1 / 1 pts else if (curNode == students⇢head) else if (curNode != students⇢head) else if (sucNode == students⇢tail) else if (curNode == students⇢tail)  Question 20 1 / 1 pts Node Tim's prev pointer The list's tail Node Tom's prev pointer The list's head  Which XXX would replace the missing statement in the following algorithm? ListInsertAfter(students, curNode, newNode) { if (students⇢head == null) { students⇢head = newNode students⇢tail = newNode } XXX { students⇢tail⇢next = newNode newNode⇢prev = students⇢tail students⇢tail = newNode } else { sucNode = curNode⇢next newNode⇢next = sucNode newNode⇢prev = curNode curNode⇢next = newNode sucNode⇢prev = newNode } } When executing ListRemove(students, node Sam) on the following doubly-linked list, what will change? This study source was downloaded by from CourseH on :39:55 GMT -06:00 Question 21 1 / 1 pts head = node Fish, Tail = node Dog head = node Bird, Tail = node Fish head = node Cat, Tail = node Dog head = node Bird, Tail = node Dog  Question 22 1 / 1 pts sucNode⇢prev = predNode list⇢tail = predNode sucNode⇢prev = predNode predNode⇢next = sucNode Given the doubly-linked list animalList (Cat, Dog), which nodes will be the head and tail nodes after the following operations? ListInsertAfter(animalList, node Cat, node Bird) ListInsertAfter(animalList, node Dog, node Fish) ListRemove(animalList, node Cat) ListRemove(animalList, node Fish) Given the following list, which statements are executed for the operation ListRemove(students, node Sam)? This study source was downloaded by from CourseH on :39:55 GMT -06:00 Powered by TCPDF () list⇢head = sucNode predNode⇢next = sucNode sucNode⇢prev = predNode list⇢head = sucNode  Question 23 1 / 1 pts The statement curNode = list⇢head⇢next should be curNode = curNode⇢next . The statement while (curNode is not null) should be while (list⇢tail is not null) . The statement curNode = list⇢head should be curNode = list⇢tail . The statement while (curNode is not null) should be while (curNode is null) .  Question 24 1 / 1 pts Tom Identify the error in the following algorithm for traversing a linked list. ListTraverse(list) { curNode = list⇢head while (curNode is not null) { Print curNode's data curNode = list⇢head⇢next } } Given the following singly-linked list, what will be the value of the curNode’s data after the second while loop iteration? Tim Sam null  Question 25 1 / 1 pts ListTraverseReverse(students) { curNode = students⇢head while (curNode is not null) { Print curNode's data curNode = curNode⇢next } } ListTraverseReverse(students) { curNode = students⇢head while (curNode is null) { Print curNode's data curNode = curNode⇢prev } } ListTraverseReverse(students) { curNode = students⇢tail while (curNode is not null) { Print curNode's data curNode = curNode⇢prev } } ListTraverseReverse(students) { curNode = students⇢tail while (curNode is not null) { Print curNode's data curNode = curNode⇢next } }  Identify the correct algorithm for reverse traversal in the doubly-linked list studentList. Question 26 1 / 1 pts O(N2) O(N) O(N⋅logN) O(N⋅(N-1))  Question 27 1 / 1 pts ListFindInsertionPosition(studentList, dataValue) { curNodeA = null curNodeB = studentList⇢head while (curNodeB == null and dataValue curNodeB⇢data) { curNodeA = curNodeB curNodeB = curNodeB⇢next } return curNodeA } ListFindInsertionPosition(studentList, dataValue) { curNodeB = null curNodeA = studentList⇢head while (curNodeB == null and dataValue curNodeB⇢data) { curNodeA = curNodeB curNodeB = curNodeB⇢next } return curNodeB } ListFindInsertionPosition(studentList, dataValue) { curNodeA = null curNodeB = studentList⇢tail while (curNodeB != null and dataValue curNodeB⇢data) { curNodeA = curNodeB curNodeB = curNodeA } return curNodeA } What is the typical runtime for insertion sort for singly-linked lists? Identify the correct algorithm to use for finding the insertion position of a new item in the linked list studentList. ListFindInsertionPosition(studentList, dataValue) { curNodeA = null curNodeB = studentList⇢head while (curNodeB != null and dataValue curNodeB⇢data) { curNodeA = curNodeB curNodeB = curNodeB⇢next } return curNodeA }  Question 28 1 / 1 pts Given the following doubly-linked list, what is the position of the nodes after traversing the list?  Question 29 1 / 1 pts head node's next pointer may point to the list's tail node head pointer may be null tail pointer may be null head and tail pointer may point to the same node  Question 30 1 / 1 pts  Question 31 1 / 1 pts head is null tail is null head and tail point to different, non-null nodes In a doubly-linked list with 2 dummy nodes, the list's _____. Which of the following is a linked list with a dummy node? For an empty, singly-linked list with a dummy node, the list's _____. head and tail point to the same, non-null node  Question 32 1 / 1 pts dummy node last item first item middle item  Question 33 1 / 1 pts ListTraverseReverseRecursive(list) ListTraverseReverseRecursive(list⇢head⇢next) ListTraverseReverseRecursive(list⇢head) ListTraverseReverseRecursive(list⇢tail)  Question 34 1 / 1 pts call ListTraverseRecursive(node), then visit the node Given a singly-linked list with a dummy node, the operation ListRemoveAfter(list, list⇢head) causes the _____ to be removed from the list. ListTraverseReverse must traverse a linked list in reverse order. Which XXX should replace the missing statement? ListTraverseReverse(list) { XXX } ListTraverseReverseRecursive(node) { if (node is not null) { ListTraverseReverseRecursive(node⇢next) Visit node } } For forward traversal of a singly-linked list, the ListTraverseRecursive(node) function must _____. visit the node, then call ListTraverseRecursive(node⇢next) visit the node, then call ListTraverseRecursive(node) call ListTraverseRecursive(node⇢next), then visit the node  Question 35 1 / 1 pts if (node⇢head == key) if (node⇢next == key) if (node⇢tail == key) if (node⇢data == key)  Question 36 1 / 1 pts Only Tea Tea and Chips Which XXX should replace the missing statement in the following algorithm? ListSearch(myData, key) { return ListSearchRecursive(key, myData⇢head) } ListSearchRecursive(key, node) { if (node is not null) { XXX { return node } return ListSearchRecursive(key, node⇢next) } return null } Given the following list, if ListTraverseReverseRecursive(node) were called directly on node Chips, the nodes visited would be _____. Chips and Pizza Tea, Chips, and Pizza  Question 37 1 / 1 pts ArrayListAppend (list, 0, 10) ArrayListInsertBefore(list, 10) ArrayListPrepend(list, 10) ArrayListAppend(list, 10)  Question 38 1 / 1 pts 4 3 true 25  Question 39 1 / 1 pts 20, 30, 40, 50, 10 10, 20, 40, 50 10, 20, 30, 50 10, 20, 25, 40, 50  Identify the correct way to add 10 to the start of the array list: 11, 12, 13, 14. Given the array-based list (20, 12, 24, 25), what is the output of ArrayListSearch(list, 25)? Given the array-based list (20, 30, 40, 50), what will the new array look like after the following operations? ArrayListPrepend(list, 10) ArrayListSearch(list, 25) ArrayListRemoveAt(list, 3) ArrayListSearch(list, 40) Question 40 1 / 1 pts ArrayListAppend(list, newItem) { if (list⇢allocationSize == list⇢length) ArrayListResize(list, list⇢length * 1) list⇢array[list⇢size] = newItem list⇢length = list⇢length + 2 } ArrayListAppend(list, newItem) { if (list⇢allocationSize == list⇢length) ArrayListResize(list, list⇢length * 2) list⇢array[list⇢length] = newItem list⇢length = list⇢length + 1 } ArrayListAppend(list, newItem) { if (list == list⇢length) ArrayListResize(list, list⇢length * 2) list⇢array[list⇢length] = newItem list⇢length = list⇢length + 3 } ArrayListAppend(list, newItem) { if (list⇢length == list⇢lastItem) ArrayListResize(list, list⇢length * 0) list⇢array[list⇢length] = newItem list⇢length = list⇢length + 1 }  Question 41 1 / 1 pts Identify the correct algorithm to append an item in an array. Given a stack myData: Tom, Sam (top is Tom), what is the output after the following operations? Push(myData, Hal) Pop(myData) Pop(myData) Tom null Hal Sam  Question 42 1 / 1 pts 43 34 34 56 56 78 12 66  Question 43 1 / 1 pts Pop(myData) print(Pop(myData)) Given a stack myData: 34, 56, 78, 12, 66 (top is 34) what is the output after the following operations? Push(myData 43) Pop(myData) Pop(myData) print(Peek(myData)) Pop(myData) print(Peek(myData)) Given a stack myData: 34, 78 (top is 34), what is the output after the following operations? Peek(myData) Push(myData, 2) Push(myData, 15) Pop(myData) Pop(myData) Tom null Hal Sam  Question 42 1 / 1 pts 43 34 34 56 56 78 12 66  Question 43 1 / 1 pts Pop(myData) print(Pop(myData)) Given a stack myData: 34, 56, 78, 12, 66 (top is 34) what is the output after the following operations? Push(myData 43) Pop(myData) Pop(myData) print(Peek(myData)) Pop(myData) print(Peek(myData)) Given a stack myData: 34, 78 (top is 34), what is the output after the following operations? Peek(myData) Push(myData, 2) Push(myData, 15) Pop(myData) Pop(myData) This study source was downloaded by from CourseH on :40:53 GMT -06:00 false 78 false true 34 true  Question 44 1 / 1 pts append replace prepend insert  Question 45 1 / 1 pts null tail node middle node head node  Question 46 1 / 1 pts null head and tail pointers a non-null head and null tail pointer a null head and non-null tail pointer non-null head and tail pointers  Question 47 1 / 1 pts print(IsEmpty(myData)) If a stack is implemented as a linked list, then a push will be a(n) _____ operation. If a stack is implemented as a linked list, then a pop will remove the _____. If a stack is implemented as a linked list, then an empty stack will have _____. Given an empty stack menuItems, what will be the result of the following operations? This study source was downloaded by from CourseH on :40:53 GMT -06:00 Tea Tea Nachos Chips Pizza Pizza Chips Nachos Tea Pizza  Question 48 1 / 1 pts headData = stack⇢tail⇢data headData = stack⇢head⇢data headData = stack headData = null  Question 49 1 / 1 pts the middle the back the front a random  StackPush(menuItems , item Pizza) StackPush(menuItems , item Chips) StackPush(menuItems , item Nachos) StackPush(menuItems , item Tea) print(StackPop(menuItems)) If a stack is implemented as a linked list, which XXX would replace the missing statement? StackPop(stack) { XXX ListRemoveAfter(stack, null) return headData } In a queue, a dequeue operation always removes _____ element. This study source was downloaded by from CourseH on :40:53 GMT -06:00 Question 50 1 / 1 pts After 24 After 48 Before 12 After 12  Question 51 1 / 1 pts 12, 48, 72 12, 24, 72 24, 48, 72 24, 48, 12  Question 52 1 / 1 pts 24 true 24 false 12 true Given the queue myData 12, 24, 48 (front is 12), where will the new item 72 be enqueued? Given the queue myData 12, 24, 48 (front is 12), what will be the queue contents after the following operations? Enqueue(myData, 72) Dequeue(myData) Given the queue myData 12, 24, 36 (front is 12), what is the result of the following operations? Enqueue(myData, 48) Enqueue(myData, 60) Dequeue(myData) print(Peek(myData)) print(IsEmpty(myData)) This study source was downloaded by from CourseH on :40:53 GMT -06:00 12 false  Question 53 1 / 1 pts 2 1 0 3  Question 54 1 / 1 pts after the last item before the first item after the first item before the last item  Question 55 1 / 1 pts a random the tail the head the middle  Question 56 1 / 1 pts Given the queue myData 12, 24, 36 (front is 12), what is the result of the following operations? Dequeue(myData) Dequeue(myData) Dequeue(myData) print(GetLength(myData)) If a queue is implemented as a linked list, an enqueue inserts a new item _____. If a queue is implemented as a linked list, a dequeue removes _____ node. Given a Queue implemented as a linked list, identify the correct dequeue algorithm. This study source was downloaded by from CourseH on :40:53 GMT -06:00 QueueDequeue(queue) { headData = queue⇢head⇢data ListRemoveAfter(queue, queue⇢head) return headData } QueueDequeue(queue) { headData = queue⇢head⇢data ListRemoveAfter(queue, null) return headData } QueueDequeue(queue) { tailData = queue⇢tail⇢data ListRemoveAfter(queue, queue⇢tail) return tailData } QueueDequeue(queue) { tailData = queue⇢tail⇢data ListRemoveAfter(queue, null) return tailData }  Question 57 1 / 1 pts The null pointer Given the following queue, which pointer points to the new item when the operation QueueEnqueue(studentsQueue, "Hal") is executed? This study source was downloaded by from CourseH on :40:53 GMT -06:00 Powered by TCPDF () Node Tom’s next pointer The studentsQueue head pointer Node Tim’s next pointer  Question 58 1 / 1 pts pop-back pop-front push-front push-back  Question 59 1 / 1 pts PushFront(deque) PeekFront(deque) PopFront(deque) PeekBack(deque)  Question 60 1 / 1 pts 2, 10, 12, 14, 16, 18 2, 10, 12, 14, 16, 13, 18 Identify the operation to add an item to the deque at the back. _____ returns but does not remove the item at the front of the deque. Given the deque 10, 12, 14, 16 (front is 10), what will the deque look like after the following operations? push-front 2, push-back 13, push-front 8, pop-front, pop-back, push-back 18 This study source was downloaded by from CourseH on :41:11 GMT -06:00 8, 10, 12, 14, 16, 13, 18 8, 10, 12, 14, 16, 18  Question 61 1 / 1 pts false, 10, 16, true false, 10, 16, 2 false, 10, 16, true false, 10, 16, 4  Question 62 1 / 1 pts Linear search will compare all elements if the search key is not present. Linear search starts from the middle of the list to check all elements until the search key is found. Linear search is used only on sorted lists to find the required element. An algorithm is an outcome of a search after a program is executed.  Question 63 1 / 1 pts 29 µs 22 µs 20 µs 10 µs  Given the deque 10, 12, 14, 16 (front is 10), what is the outcome of the following operations? print(IsEmpty(deque)) print(PeekFront(deque)) print(PeekBack(deque)) print(GetLength(deque)) Which of the following statements is true with reference to searching? In a sorted list of prime numbers, how long will it take to search for 29 if each comparison takes 2 µs? This study source was downloaded by from CourseH on :41:11 GMT -06:00 Question 64 1 / 1 pts LinearSearch(StudentIDs, int listSize, int findEle) { for (ctr = 0; i listSize; ++ctr) { if (StudentIDs[findEle] == ctr) return findEle } } LinearSearch(StudentIDs, int listSize, int findEle) { for (ctr = 0; i listSize; ++ctr) { if (StudentIDs[listSize] == ctr) return findEle } } LinearSearch(StudentIDs, int listSize, int findEle) { for (ctr = 1; i listSize; ctr++) { if (StudentIDs[ctr] == listSize) return ctr } } LinearSearch(StudentIDs, int listSize, int findEle) { for (ctr = 0; i listSize; ++ctr) { if (StudentIDs[ctr] == findEle) return ctr } }  Question 65 1 / 1 pts Binary search starts from the center of a sorted list. Binary search is used on unsorted lists to find the required element. A linear search typically has a shorter runtime than a binary search. Which of the following algorithms is correct for applying linear search to find the element findEle in a list StudentIDs? Which of the following statements is true with reference to searching algorithms? This study source was downloaded by from CourseH on :41:11 GMT -06:00 Linear search starts from the center of a sorted list.  Question 66 1 / 1 pts 9 4 26 11  Question 67 1 / 1 pts if (high = low) if (high = low) while (high = low) while (high = low)  Question 68 1 / 1 pts Assume an ordered list containing the English alphabet. Using binary search, how many letters are checked to locate the letter "K"? Which XXX completes the binary search algorithm? BinarySearch(numbers, numbersSize, key) { mid = 0 low = 0 high = numbersSize - 1 XXX { mid = (high + low) / 2 if (numbers[mid] key) { low = mid + 1 } else if (numbers[mid] key) { high = mid - 1 } else { return mid } } return -1 } This study source was downloaded by from CourseH on :41:11 GMT -06:00 1. Binary search first checks the last element of the list. 2. If the search key is not found, the algorithm: i. checks the first element of the list or ii. checks the right sublist if the search key is greater than the middle element. 1. Binary search first checks the middle element of the list. 2. If the search key is not found, the algorithm: i. checks the left sublist if the search key is less than the middle element or ii. checks the right sublist if the search key is greater than the middle element. 1. Binary search first checks the middle element of the list. 2. If the search key is not found, the algorithm: i. checks the right sublist if the search key is less than the middle element or ii. checks the left sublist if the search key is greater than the middle element. 1. Binary search first checks the first element of the list. 2. If the search key is not found, the algorithm: i. checks the middle element of the list or ii. checks the right sublist if the search key is greater than the middle element.  Question 69 1 / 1 pts 6 32 1024 36  Question 70 1 / 1 pts Identify the correct sequence of performing a binary search. If the C++ LinearSearch() function is called to search an array of 32 numbers, then at most _____ array numbers are compared against the search key. This study source was downloaded by from CourseH on :41:11 GMT -06:00 Powered by TCPDF () 1. Binary search first checks the last element of the list. 2. If the search key is not found, the algorithm: i. checks the first element of the list or ii. checks the right sublist if the search key is greater than the middle element. 1. Binary search first checks the middle element of the list. 2. If the search key is not found, the algorithm: i. checks the left sublist if the search key is less than the middle element or ii. checks the right sublist if the search key is greater than the middle element. 1. Binary search first checks the middle element of the list. 2. If the search key is not found, the algorithm: i. checks the right sublist if the search key is less than the middle element or ii. checks the left sublist if the search key is greater than the middle element. 1. Binary search first checks the first element of the list. 2. If the search key is not found, the algorithm: i. checks the middle element of the list or ii. checks the right sublist if the search key is greater than the middle element.  Question 69 1 / 1 pts 6 32 1024 36  Question 70 1 / 1 pts Identify the correct sequence of performing a binary search. If the C++ LinearSearch() function is called to search an array of 32 numbers, then at most _____ array numbers are compared against the search key. This study source was downloaded by from CourseH on :41:35 GMT -06:00 36 6 32 1024  Question 71 1 / 1 pts mid = (double)(high + low) / 2.0; mid = high / 2 + low; mid = (high + low) / 2; mid = high + low / 2;  Question 72 1 / 1 pts return key; return numbers[key]; return i; return numbers[i];  Question 73 1 / 1 pts both the LinearSearch() and BinarySearch() functions If the C++ BinarySearch() function is called to search a sorted array of 32 numbers, then at most _____ array numbers are compared against the search key. In the C++ BinarySearch() function, what code is used to compute the middle index? Which XXX completes the C++ LinearSearch() function? int LinearSearch(int* numbers, int numbersSize, int key) { for (int i = 0; i numbersSize; i++) { if (numbers[i] == key) { XXX } } return -1; // not found } In C++, the array { 36, 46, 71, 31, 88, 72 } can be used as input to _____. This study source was downloaded by from CourseH on :41:35 GMT -06:00 neither the LinearSearch() nor the BinarySearch() function only the BinarySearch() function only the LinearSearch() function  Question 74 1 / 1 pts apple, orange, banana, pear 89, 79, 63, 22 Ted, Tom, Thomas, Tim 1.01, 1.02, 1.1, 1.001  Question 75 1 / 1 pts the first element with each element all the elements two elements at a time the first and middle elements  Question 76 1 / 1 pts 20.025, 20.12, 20.245, 20.24 20.24, 20.245, 20.12, 20.025 20.025, 20.12, 20.24, 20.245 20.245, 20.24, 20.12, 20.025  Question 77 1 / 1 pts next leftmost Which of the following lists is sorted? During sorting the algorithm swaps _____. Sort the following list into descending order.20.24, 20.12, 20.245, 20.025 In selection sort, the smallest element is selected and swapped with the _____ unsorted element. This study source was downloaded by from CourseH on :41:35 GMT -06:00 rightmost middle  Question 78 1 / 1 pts 23, 32, 53, 80, 67, 60 23, 32, 67, 53, 80, 60 23, 32, 53, 67, 80, 60 23, 32, 80, 53, 60, 67  Question 79 1 / 1 pts list[mimIndex] = list[ctr2] list[mimIndex] = list[ctr1] list[ctr1] = list[mimIndex] list[ctr2] = list[mimIndex]  Question 80 1 / 1 pts The array (67, 23, 32, 80, 53, 60) is to be sorted using selection sort. What is the order of the elements after the third swap? Which XXX should replace the missing statement in the selection sort algorithm given below? SelectionSort(list, listSize) { for (ctr1 = 0; ctr1 listSize - 1; ++ctr1) { mimIndex = ctr1 for (ctr2 = ctr1 + 1; ctr2 listSize; ++ctr2) { if (list[ctr2] list[mimIndex]) { mimIndex = ctr2 } } temp = list[ctr1] XXX list[mimIndex] = temp } } Sort the following list of video extensions using selection sort: mpg, mp4, mov, mkv, m4v. What is the order of the elements after the second swap? This study source was downloaded by from CourseH on :41:35 GMT -06:00 (m4v, mkv, mov, mp4, mpg) (m4v, mp4, mov, mkv, mpg) (mov, mkv, mpg, mp4, m4v) (mpg, mp4, mov, mkv, m4v)  Question 81 1 / 1 pts 9 10 1 2  Question 82 1 / 1 pts ods, txt, xlr, xls, xlsx xlr, xls, xlsx, txt, ods txt, xlr, xls, xlsx, ods xls, xlsx, xlr, txt, ods  Question 83 1 / 1 pts while(j 0 && numbers[j] numbers[j+1]) A list of 10 elements is to be sorted using insertion sort algorithm. How many times will the outer loop be executed? Given the list (xlsx, xls, xlr, txt, ods), what is the order of the elements after completing insertion sort's second outer loop iteration? Which XXX completes the following insertion sort algorithm to sort in descending order? for (i = 1; i numbersSize; ++i) { j = i XXX { temp = numbers[j] numbers[j] = numbers[j - 1] numbers[j - 1] = temp --j } } This study source was downloaded by from CourseH on :41:35 GMT -06:00 while(j 0 && numbers[j] numbers[j-1]) while(j 0 && numbers[j] numbers[j+1]) while(j 0 && numbers[j] numbers[j-1])  Question 84 1 / 1 pts 7, 8, 12, 23, 5, 6 7, 23, 12, 8, 5, 6 7, 12, 23, 8, 5, 6 5, 7, 8, 12, 23, 6  Question 85 1 / 1 pts 40 20 190 400  Question 86 1 / 1 pts 4 1 2 0  Question 87 1 / 1 pts Given the list (7, 23, 12, 8, 5, 6), what is the order of the elements after the third insertion sort swap? Insertion sort requires at most _____ swaps to sort a list of 20 elements. Shell sort ends with what gap value? Identify the correct algorithm for shell sort. This study source was downloaded by from CourseH on :41:35 GMT -06:00 Powered by TCPDF () Step 1 - Initialize a gap value of K Step 2 – Divide the list into smaller interleaved lists of equal interval h Step 3 - Sort the interleaved lists using selection sort Step 4 - Reduce the value of K and repeat until complete list is sorted Step 1 - Initialize a gap value of K Step 2 – Divide the list into smaller interleaved lists of equal interval h Step 3 - Sort the interleaved lists using insertion sort Step 4 – Reduce the value of K and repeat until complete list is sorted Step 1 - Initialize a gap value of K Step 2 – Divide the list into h number of sub-lists Step 3 - Sort the interleaved lists using selection sort Step 4 – Combine the sorted interleaved lists Step 1 - Initialize a gap value of K Step 2 – Divide the list into h number of interleaved lists Step 3 - Sort the interleaved lists using insertion sort Step 4 – Combine the sorted interleaved lists  Question 88 1 / 1 pts 12, 15, 16, 25, 37, 33, 40, 42 12, 15, 16, 37, 33, 40, 25, 42 15, 16, 25, 12, 33, 37, 40, 42 15, 16, 25, 12, 37, 33, 40, 42  Question 89 1 / 1 pts 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? Identify the correct shell sort algorithm for the given interleaved sorting. This study source was downloaded by from CourseH on :41:51 GMT -06:00 ShellSort(listOfGames, listSize, gapValues) { for each (gapValue in gapValues) { for (i = gapValue; i 0; i--) { InsertionSortInterleaved(listOfGames, listSize, i, gapValue) } } } ShellSort(numbers, numbersSize, gapValues) { for each (gapValue in gapValues) { for (i = 0; i gapValue; i++) { InsertionSortInterleaved(numbers, numbersSize, i, gapValue) } } } ShellSort(list, listSize, gapValues) { for each (gapValue in gapValue) { for (i = 1; i gapValue; ++i) { InsertionSortInterleaved(listOfGames, listSize, i, gapValue) } } } InsertionSortInterleaved(numbers, numbersSize, startIndex, gap) { i = 0 j = 0 temp = 0 // Temporary variable for swap for (i = startIndex + gap; i numbersSize; i = i + gap) { j = i while (j - gap = startIndex && numbers[j] numbers[j - gap]) { temp = numbers[j] numbers[j] = numbers[j - gap] numbers[j - gap] = temp j = j - gap } } } This study source was downloaded by from CourseH on :41:51 GMT -06:00 ShellSort(listOfGames, listSize, gapValues) { for each (gapValue in gapValues) { InsertionSortInterleaved(listOfGames, listSize, i) } }  Question 90 1 / 1 pts (27, 40, 15, 25) and (10, 19, 30) (25, 10, 19, 30) and (27, 40, 15) (19, 27, 30, 40) and (10, 15, 25) (10, 15, 19, 25) and (27, 30, 40)  Question 91 1 / 1 pts O(N2) O(2N) O(N) O(N⋅log(N))  Question 92 1 / 1 pts if(highIndex 0) if(lowIndex = highIndex) Given the list (27, 40, 15, 25, 10, 19, 30), what are the new partitioned lists if the pivot is 25? Which is the worst case runtime for a quicksort algorithm? Which XXX will replace the missing conditional statement in the following code for quicksort? Quicksort(numbers, lowIndex, highIndex) { XXX { return } lowEndIndex = Partition(numbers, lowIndex, highIndex) Quicksort(numbers, lowIndex, lowEndIndex) Quicksort(numbers, lowEndIndex + 1, highIndex) } This study source was downloaded by from CourseH on :41:51 GMT -06:00 if(lowIndex 0) if(lowIndex = highIndex)  Question 93 1 / 1 pts The statement myList[low] = myList[high] should be myList[low] = pivot The statement while (completed) should be while (!completed) The statement while (pivot myList[high]) should be while (pivot myList[high]) The statement myList[low] = myList[high] should be myList[high] = myList[low]  Question 94 1 / 1 pts Quicksort(myList, lowIndex, highIndex) { if (lowIndex = highIndex) { return } lowEndIndex = Partition(myList, lowEndIndex, highIndex) Quicksort(myList, lowIndex, highIndex) Quicksort(myList, lowIndex + 1, highIndex) } Identify the error in the following code snippet of the quicksort partition function. while (completed) { while (myList[low] pivot) { ++low } while (pivot myList[high]) { --high } if (low = high) completed = true else { temp = myList[low] myList[low] = myList[high] myList[high] = temp ++low --high } } Which is the correct implementation of the quicksort algorithm? This study source was downloaded by from CourseH on :41:51 GMT -06:00 Quicksort(myList, lowIndex, highIndex) { if (lowIndex = highIndex) { return } lowEndIndex = Partition(myList, lowIndex, highIndex) Quicksort(myList, lowIndex, lowEndIndex) Quicksort(myList, lowEndIndex + 1, highIndex) } Quicksort(myList, lowIndex, highIndex) { if (lowIndex = highIndex) { return } lowEndIndex = Partition(myList, lowIndex, highIndex) Quicksort(myList, lowIndex, lowEndIndex -1) Quicksort(myList, lowEndIndex - 1, highIndex) } Quicksort(myList, lowIndex, highIndex) { if (lowIndex = highIndex) { return } lowEndIndex = Partition(myList, lowIndex, highIndex) Quicksort(myList, lowIndex, lowEndIndex) Quicksort(myList, lowEndIndex + 1, highIndex) }  Question 95 1 / 1 pts (2, 5, 8) and (12, 19, 30) (2, 12, 8) and (5, 19, 30) (2, 12, 8) and (19, 5, 30) (2, 8, 12) and (5, 19, 30)  Question 96 1 / 1 pts 6 Given the number list (2, 12, 8, 19, 5, 30), identify the merged list in merge sort after the completion of the second level. How many additional recursive partitioning levels are required for a list of 64 elements compared to a list of 8 elements? This study source was downloaded by from CourseH on :41:51 GMT -06:00 Powered by TCPDF () Quicksort(myList, lowIndex, highIndex) { if (lowIndex = highIndex) { return } lowEndIndex = Partition(myList, lowIndex, highIndex) Quicksort(myList, lowIndex, lowEndIndex) Quicksort(myList, lowEndIndex + 1, highIndex) } Quicksort(myList, lowIndex, highIndex) { if (lowIndex = highIndex) { return } lowEndIndex = Partition(myList, lowIndex, highIndex) Quicksort(myList, lowIndex, lowEndIndex -1) Quicksort(myList, lowEndIndex - 1, highIndex) } Quicksort(myList, lowIndex, highIndex) { if (lowIndex = highIndex) { return } lowEndIndex = Partition(myList, lowIndex, highIndex) Quicksort(myList, lowIndex, lowEndIndex) Quicksort(myList, lowEndIndex + 1, highIndex) }  Question 95 1 / 1 pts (2, 5, 8) and (12, 19, 30) (2, 12, 8) and (5, 19, 30) (2, 12, 8) and (19, 5, 30) (2, 8, 12) and (5, 19, 30)  Question 96 1 / 1 pts 6 Given the number list (2, 12, 8, 19, 5, 30), identify the merged list in merge sort after the completion of the second level. How many additional recursive partitioning levels are required for a list of 64 elements compared to a list of 8 elements? This study source was downloaded by from CourseH on :42:15 GMT -06:00 8 9 3  Question 97 1 / 1 pts O(logN) O(N·logN) O(N2) O(N)  Question 98 1 / 1 pts MergeSort(myList, i, k) { j = 0 if (i k) { j = (i + k) / 2 Merge(myList, i, j, k) MergeSort(myList, i, j) MergeSort(myList, j + 1, k) } } MergeSort(myList, i, k) { j = 0 if (i k) { j = (i + k) / 2 MergeSort(myList, i, j) MergeSort(myList, j, k + 1) Merge(myList, i, j + 1, k) } } What is the merge sort algorithm's runtime? Identify the correct MergeSort function. This study source was downloaded by from CourseH on :42:15 GMT -06:00 MergeSort(myList, i, k) { j = 0 if (i k) { j = (i + k) / 2 MergeSort(myList, i, j) MergeSort(myList, j + 1, k) Merge(myList, i, j, k) } } MergeSort(myList, i, k) { j = 0 if (i k) { j = (i + k) / 2 MergeSort(myList, i, j) MergeSort(myList, j + 1, k) Merge(myList, i, j, k) } }  Question 99 1 / 1 pts (62, 45, 29, 32, 25, 10, 75) (10, 62, 32, 45, 25, 75, 29) (10, 32, 62, 25, 45, 75, 29) (10, 25, 29, 32, 45, 62, 75)  Question 100 1 / 1 pts (20, 50, -52, -53, -35, 65) (20, 50, -52, -53, 65, -35) (-35, -53, -52, 50, 20, 65) (-35, -52, -53, 20, 50, 65)  Question 101 1 / 1 pts Given the list (62, 45, 29, 32, 25, 10, 75), what is the list after sorting by the 1’s digit? Given the list (20, -35, 50, -52, 65, -53), what is the list after sorting by the 1’s digit? This study source was downloaded by from CourseH on :42:15 GMT -06:00 (23, 35, 67, -11, -32, -45, -89) (-89, -45, -32, -11, 23, 35, 67) (-11, -32, -45, -89, 23, 35, 67) (-11, 23, -32, 35, -45, 67, -89)  Question 102 1 / 1 pts FindMaxLen(listOfAges, listSize) { maxDigits = 0 for (i = 0; i listSize; i++) { digitCount = FindLen(listOfAges[i]) if (digitCount maxDigits) maxDigits = digitCount } return maxDigits } FindMaxLen(listOfAges, listSize) { maxDigits = 0 for (i = 0; i = listSize; i++) { digitCount = FindMaxLen(listOfAges[i]) if (digitCount maxDigits) maxDigits = digitCount } return maxDigits } Given the list (-45, 35, -32, 67, -89, 23, -11), what will be the final sorted list? The following code finds the number of digits in an integer. Identify the correct algorithm to find the maximum number of digits in an integer array. FindLen(value) { if (value == 0) return 1 digits = 0 while (value != 0) { digits = digits + 1 value = value / 10 } return digits } This study source was downloaded by from CourseH on :42:15 GMT -06:00 FindMaxLen(listOfAges, listSize) { maxDigits = 0 for (i = 0; i = listSize; i++) { digitCount = FindLen(listOfAges[i]) if (digitCount maxDigits) maxDigits = digitCount } return maxDigits } FindMaxLen(listOfAges, listSize) { maxDigits = 0 for (i = 0; i listSize; i++) { digitCount = FindMaxLen(listOfAges[i]) if (digitCount maxDigits) maxDigits = digitCount } return maxDigits }  Question 103 1 / 1 pts Selection sort Shell sort Insertion sort Quicksort  Question 104 1 / 1 pts Merge sort Shell sort Insertion sort Selection sort  Question 105 1 / 1 pts Which of the following is a fast sorting algorithm? Which of the following is the fastest algorithm to sort a string? Which of the following algorithms has the same best, average, and worst case runtime complexity? This study source was downloaded by from CourseH on :42:15 GMT -06:00 Insertion sort Merge sort Quicksort Shell sort  Question 106 1 / 1 pts (45.1, -65.6, 89.8, -34.5, 23.3) (1, 22, 333, 4444, 55555) (44, 789, 5678, 90, 1) (-67, -89, -34, -10, -65)  Question 107 1 / 1 pts Insertion sort Shell sort Radix sort Selection sort  Question 108 1 / 1 pts A single algorithm can execute more quickly on a faster processor. The runtime of an algorithm is independent of the input values. The runtime of an algorithm is independent of the speed of the processor. The runtime of an algorithm is analyzed in terms of nanoseconds.  Question 109 1 / 1 pts the input values of the code Which list cannot be sorted using the standard Radix sort algorithm? Which sorting technique does not compare two values and then sort the values? Which of the following statements is true with reference to an algorithm’s runtime? A constant time operation is independent of _____. This study source was downloaded by from CourseH on :42:15 GMT -06:00 Powered by TCPDF () the hardware running the code the programming language the output of the code  Question 110 1 / 1 pts Finding the occurrence of a string in a sorted array Finding the sum of two numbers input by the user Finding the minimum value in an unsorted array Concatenating two strings entered by the user  Question 111 1 / 1 pts for (i = 0; i length; i++) sum += i while (x y) x = x + 1 x = array[option] temp = array[option + 1] string str1 string str2 string str3 = concat(str1, str2)  Question 112 1 / 1 pts Which of the following is a constant time operation? Identify the constant time operation. Identify the non-constant time operation. This study source was downloaded by from CourseH on :42:56 GMT -06:00 if (x y) return x for (i = 0; i 10; i++) sum += num2 i = 0 while (i listSize) { sum = sum + i i++ } num = arr[i] arr[i + 1] = num + 1  Question 113 1 / 1 pts ≤ the best case ≥ the worst case ≤ the worst case ≥ the best case  Question 114 1 / 1 pts 4N2+10N 7N 19N2 7N2 The lower bound of an algorithm’s runtime complexity is _____. The upper bound of an algorithm with best case runtime T(N)=3N+16 and worst case runtime T(N)=4N2+10N+5 is _____. This study source was downloaded by from CourseH on :42:56 GMT -06:00  Question 115 1 / 1 pts T(N)=Θ(f(N)) T(N)=O(f(N)) T(N)=Ω(f(N)) T(N)=N(f(N))  Question 116 1 / 1 pts 3N2 N2 12N 7  Question 117 1 / 1 pts O(N3) O(N5) O(5N3) O(N3+N2)  Question 118 1 / 1 pts Bubble sort Accessing an element of an array Binary search Finding the minimum value of an array  Identify the notation for algorithm complexity that has a positive constant c for all T(N)≥c*f(N). The Big O notation of the algorithm 7+12N+3N2 is _____. The Big O notation of the composite function 5N3+O(N2) is _____. Which of the following is an example of constant time O(1)? This study source was downloaded by from CourseH on :42:56 GMT -06:00 Question 119 1 / 1 pts an exponential runtime complexity a linear runtime complexity a logarithmic runtime complexity a constant runtime complexity  Question 120 1 / 1 pts O(N2) O(N) O(N·logN) O(1)  Question 121 1 / 1 pts the average the optimum the minimum The following algorithm is an example of _____. def MyMath(num) if num = 1 return num return MyMath(num - 2) + MyMath(num - 1) What is the runtime complexity notation for the following algorithm? LowNum(listOfAgeGroups, listSize, myAge) { for (ctr = 0; ctr listSize; ++ctr) { if (listOfAgeGroups[ctr] == myAge) return ctr } } } The worst-case runtime of an algorithm is _____ number of steps taken to execute a program. This study source was downloaded by from CourseH on :42:56 GMT -06:00 the maximum  Question 122 1 / 1 pts O(50N) O(50) 50·O(1) O(1)  Question 123 1 / 1 pts f(N)=6N2 f(N)=2N f(N)=8N2+4 f(N)=5N+2  Question 124 1 / 1 pts The Big O notation for an algorithm with exactly 50 constant time operations is _____. Which function best represents the number of operations in the worst-case? for (i = 0; i N; ++i) { if (numbers[i] % 2 == 1) factor = 2.5 } What is the Big O notation for the following algorithm? ctr = 0 while (ctr N) { myAge = ctr val = ctr + 1 while (val N) { if (ageOfPeople[val] ageOfPeople[myAge]) myAge = val ++val } tempList = ageOfPeople[ctr] ageOfPeople [ctr] = ageOfPeople [myAge] This study source was downloaded by from CourseH on :42:56 GMT -06:00 ageOfPeople [myAge] = tempList Powered by TCPDF () the maximum  Question 122 1 / 1 pts O(50N) O(50) 50·O(1) O(1)  Question 123 1 / 1 pts f(N)=6N2 f(N)=2N f(N)=8N2+4 f(N)=5N+2  Question 124 1 / 1 pts The Big O notation for an algorithm with exactly 50 constant time operations is _____. Which function best represents the number of operations in the worst-case? for (i = 0; i N; ++i) { if (numbers[i] % 2 == 1) factor = 2.5 } What is the Big O notation for the following algorithm? ctr = 0 while (ctr N) { myAge = ctr val = ctr + 1 while (val N) { if (ageOfPeople[val] ageOfPeople[myAge]) myAge = val ++val } tempList = ageOfPeople[ctr] ageOfPeople [ctr] = ageOfPeople [myAge] ageOfPeople [myAge] = tempList O(N2) O(logN) O(N) O(1)  Question 125 1 / 1 pts O(1) O(N) O(N-1) O(N/2)  Question 126 1 / 1 pts terminates loops provides input to passes a parameter to  Question 127 1 / 1 pts MySalaryCalulator(tempSal) { if (tempSal = 500) return -1 else MySalaryCalculator(tempSal - 500) } ++ctr } The best case runtime complexity of an algorithm that searches an array of size N is _____. In a recursive function, the base case _____ the function. Which of the following is an example of a recursive function? MySalaryCalculator(tempSal) { if (tempSal = 500) return -1 else tempSal = tempSal + 1000 } MySalaryCalculator(tempSal) { if (tempSal = 500) return -1 else tempSal = tempSal + 1000 } MySalaryCalculator(tempSal) { if (tempSal = 500) return -1 else print(tempSal) }  Question 128 1 / 1 pts return CountOccurrences(numbers, numbersLength, value, startIndex - 1) Which XXX base case completes the algorithm to count the number of occurrences of a value in a list of numbers? CountOccurrences(numbers, numbersLength, value, startIndex) { XXX if (numbers[startIndex] == value) return 1 + CountOccurrences(numbers, numbersLength, value, startIndex + 1) else return CountOccurrences(numbers, numbersLength, value, startIndex + 1) } if (value == startIndex) return 1 if (startIndex == 0) return numbersLength if (startIndex = numbersLength) return 0  Question 129 1 / 1 pts AscendingList(empList, end, begin) AscendingList(empList, begin + 1, end - 1) AscendingList(empList, begin - 1, end + 1) AscendingList(empList, begin, end)  Question 130 1 / 1 pts itself A list of employees that has been sorted in descending order needs to be reversed. Which XXX completes the algorithm to sort the list in ascending order? AscendingList(empList, begin, end) { if (begin = end) return else { Swap empList[begin] and empList[end] XXX } } A recursive function calls _____. at least two more functions the main function another function  Question 131 1 / 1 pts if (N 0) if (N != 0) if (N == 0) if (N 0)  Question 132 1 / 1 pts The list must be sorted in descending order. The list must have an even number of elements. The list must have an odd number of elements. The list must be sorted in ascending order.  Question 133 1 / 1 pts 3 0 Given the following code for generating the Fibonacci series for N numbers, which XXX would replace the missing statement? FibonacciNumber(N) { XXX return 0 else if (N == 1) return 1 else return FibonacciNumber(N - 1) + FibonacciNumber(N - 2) } Which of the following is the main requirement for a binary search algorithm? Given a list (0, 1, 1, 2, 3, 5, 8, 13, 17), the binary search algorithm calls BinarySearch(list, 0, 8, 3). What is the index of the middle element? 4 2  Question 134 1 / 1 pts recursive tree recurrence relation infinite tree constant relation  Question 135 1 / 1 pts Every time the function is called, k operations are done, and the recursive call lowers N by 1. Every time the function is called, k operations are done, and each recursive call lowers N by one fourth. Every time the function is called, k operations are done, and the recursive call lowers N by k. Every time the function is called, k operations are done, and each of the 2 recursive calls reduces N by half.  Question 136 1 / 1 pts O(N2·logN) O(N2) O(5N2·logN) O(N·logN)  Question 137 1 / 1 pts stack graph A(n) _____ is a function f(N) that is defined in terms of the same function and operates on a value less than N. Which explanation matches the following runtime complexity? T(N)=k+T(N-1) What is the Big O notation for a recursive function with a runtime complexity of T(N)=5N+T(N-1)? Which data type is best suited to store the names and grades of students? record array  Question 138 1 / 1 pts pointer to copy of child of memory of  Question 139 1 / 1 pts A work scheduling operation The Undo command in a word processor A file system on a computer A telephone network  Question 140 1 / 1 pts value size data type item  Question 141 1 / 1 pts In a linked list, each node stores a _____ the next node. Which of the following is best represented by a graph? Appending an element in an array involves increasing the array’s _____. Which XXX will complete the algorithm to separate numberList into two lists (even and odd) using an array? if (numberList[i] % 1 == 1) if (numberList[i] % 2 == 0) if (numberList[i] % 2 == 1) if (numberList[i] % 1 == 0)  Question 142 1 / 1 pts [2, 4, 6, 8, 10] [0, 2, 4, 6, 8] [1, 2, 3, 4, 5] [1, 3, 5, 7, 9]  MathematicalFunction(numberList) { Create evenNumberList array Create oddNumberList array for (i = 0; i numberList⇢length; ++i) { XXX { ArrayAppend(evenNumberList, numberList[i]) } else { ArrayAppend(oddNumberList,numberList[i]) } SortAscending(evenNumberList) SortAscending(oddNumberList) } for (i = 0; i evenNumberList⇢length; ++i) { Display evenNumberList[i] } for (i = 0; i oddNumberList⇢length; ++i) { Display oddNumberList[i] } } What values are stored in the list numList? numberList() { for (i = 0; i 10; i++) { if (i % 2 == 0) { numList[i] = i } } } Question 143 1 / 1 pts A priority queue A deque A linked list A queue  Question 144 1 / 1 pts A linked list A stack A set An array  Question 145 1 / 1 pts A queue A linked list A deque An array  Question 146 1 / 1 pts algorithm optimization abstraction data structure  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? Which abstract data type (ADT) is best suited to store the names of all currently available smartphone models? Which abstract data type (ADT) is suited to check whether a given string is a palindrome? The process of providing only the essentials and hiding the details is known as _____. Question 147 1 / 1 pts The list ADT supports the printing of the list contents but the queue ADT does not. 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 queue ADT supports the insertion and deletion of items at the front and the back.  Question 148 1 / 1 pts low memory usage low runtime high memory usage high computational efficiency  Question 149 1 / 1 pts best case best time worst case average case  Question 150 1 / 1 pts Which of the following statements is correct? Complexity analysis helps in avoiding algorithms with _____. An algorithm's _____ is the scenario where the algorithm does the minimum possible number of operations. What is the space complexity of the algorithm? ArithmeticSeries(list, listSize) { i = 0 arithmeticSum = 0 while (i listSize) { arithmeticSum = arithmeticSum + list[i] i = i + 1 S(N) = N + k S(N) = k S(N) = N S(N) = N * k Quiz Score: 150 out of 150 } return arithmeticSum }

Show more Read less

Content preview

ListPrepend(myList, node 75)

ListInsert(myList, node 76)

ListInsert(myList, node 68)


ListPrepend(myList, node 75)

ListPrepend(myList, node 76)

ListPrepend(myList, node 68)


Question 3
pts
In the ListInsertAfter function for singly-linked lists, the curNode parameter is ignored when _____.
Correct!
the list's head pointer is null
the newNode argument is also null
the list has more than 2 items
the list's head and tail pointers point to different nodes

Question 4
pts
Given the singly-linked list (11, 33, 44, 66), identify the commands for inserting 22 and 55, such that the
final list is (11, 22, 33, 44, 55, 66).

ListInsertAfter(list, node 22)

ListInsertAfter(list, node 55)

Correct!

ListInsertAfter(list, node 11, node 22)

ListInsertAfter(list, node 44, node 55)

ListInsertAfter(list, node 11, node 22, node 55)

ListInsertAfter(list, node 0, node 22)

ListInsertAfter(list, node 3, node 55)


Question 5
pts

Which
This study XXX completes
source was downloaded bythe followingfrom
100000900703063 algorithm for inserting
CourseHero.com on 02-12-2026 a newGMT
14:39:11 node into a singly-linked list?
-06:00


https://www.coursehero.com/file/248717024/Quiz-Mid-Term-Exam-1pdf/

, ListInsertAfter(list, curNode, newNode) {
if (list⇢head == null) {
list⇢head = newNode
list⇢tail = newNode
}
else if (curNode == list⇢tail) {
list⇢tail⇢next = newNode
list⇢tail = newNode
}
else {
XXX
}
}

Correct!


newNode⇢next = curNode⇢next
curNode⇢next = newNode




newNode⇢next = curNode⇢next
curNode = newNode




newNode⇢next = null
curNode⇢next = list⇢tail⇢next




newNode⇢next = curNode⇢next
curNode⇢next = null





Question 6
pts
Given the singly-linked list (88, 99), which node will be removed by the ListRemoveAfter(list, node 88)
command?
The head node
The list will be removed.
Correct!
The tail node
No node will be removed.

This study source was downloaded by 100000900703063 from CourseHero.com on 02-12-2026 14:39:11 GMT -06:00


https://www.coursehero.com/file/248717024/Quiz-Mid-Term-Exam-1pdf/

,Question 7
pts
Given the singly-linked list (10, 20, 30, 40, 50, 60), what commands remove 10, 20, and 60, such that
the final list is (30, 40, 50)?

ListRemoveAfter(list, null)

ListRemoveAfter(list, node 20)

ListRemoveAfter(list, node 60)


ListRemoveAfter(list, null)

ListRemoveAfter(list, node 10)

ListRemoveAfter(list, node 50)

Correct!

ListRemoveAfter(list, null)

ListRemoveAfter(list, null)

ListRemoveAfter(list, node 50)


ListRemoveAfter(list, null)

ListRemoveAfter(list, null)

ListRemoveAfter(list, node 60)


Question 8
pts

Which XXX completes the algorithm to remove a node from the singly-linked list?



ListRemoveAfter(list, curNode) {
if (curNode is null && list⇢head is not null) {
sucNode = list⇢head⇢next
list⇢head = sucNode
if (sucNode is null) {
XXX
}
}
else if (curNode⇢next is not null) {
sucNode = curNode⇢next⇢next
curNode⇢next = sucNode
if (sucNode is null) {
list⇢tail = curNode
}

This study source was downloaded by 100000900703063 from CourseHero.com on 02-12-2026 14:39:11 GMT -06:00


https://www.coursehero.com/file/248717024/Quiz-Mid-Term-Exam-1pdf/

, }
}

Correct!
list⇢tail = null

list⇢head = sucNode

sucNode = list⇢head⇢next

list⇢tail = curNode


Question 9
pts
Given the singly-linked list (80, 81, 82, 83), what is returned from ListSearch(list, 84)?
1
Node 80
Correct!
Null
True

Question 10
pts
Given the singly-linked list (10, 20, 30, 40, 50, 60), ListSearch(list, 30) points the current node pointer to
_____ after checking node 20.
node 10
node 40
node 20
Correct!
node 30

Question 11
pts
ListSearch visits _____ when searching for 83 in the singly-linked list (80, 81, 82, 83).
Correct!
all the nodes
only the first and last nodes
only the last node
only the first node

Question 12
pts
This study source was downloaded by 100000900703063 from CourseHero.com on 02-12-2026 14:39:11 GMT -06:00


https://www.coursehero.com/file/248717024/Quiz-Mid-Term-Exam-1pdf/

Document information

Uploaded on
February 12, 2026
Number of pages
63
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$20.59
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
MindCraft Nightingale College
View profile
Follow You need to be logged in order to follow users or courses
Sold
236
Member since
1 year
Number of followers
5
Documents
2403
Last sold
2 days ago
All Academic Solutions 100% non -Ai.

Above all i'm here genuinely to help you in your course work. Do not hesitate to purchase or reach out to me, i'll absolutely get what you need. Get all latest solutions and answer keys, 100% non- ai, all the best.

3.3

32 reviews

5
11
4
7
3
5
2
0
1
9

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions