Comp Sci Study Guide

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Shell sort ends with what gap value?

1

Identify the correct sequence for inserting an item in a linked list. 1. Shift higher-indexed items. 2. Create a list node for a new item. 3. Assign a pointer to point to the new item. 1. Shift higher-indexed items. 2. Assign a pointer to point to a new item. 3. Create a list node for the new item. 1. Create a list node for a new item. 2. Assign a pointer of the new item to point to the next item. 3. Update the pointer of the previous node to point to the new node. 1. Create a list node for a new item. 2. Update the pointer of the previous node to point to the new node. 3. Assign a pointer of the new item to point to the next item.

1. Create a list node for a new item. 2. Assign a pointer of the new item to point to the next item. 3. Update the pointer of the previous node to point to the new node.

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

11

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? 12, 15, 16, 37, 33, 40, 25, 42 15, 16, 25, 12, 33, 37, 40, 42 15, 16, 25, 12, 37, 33, 40, 42 12, 15, 16, 25, 37, 33, 40, 42

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

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

4

Identify the correct MergeSort function. <code>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) } }</code> 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) } } <code>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) } }</code> <code>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) } }</code>

<code>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) } }</code>

Which is an abstract data type (ADT)?

A list

Which of the following statements is true with reference to an algorithm's runtime?

A single algorithm can execute more quickly on a faster processor.

Which of the following is an example of constant time O(1) ?

Accessing an element of an array

Which of the following is an example of constant time O(1) ? Accessing an element of an array Finding the minimum value of an array Binary search Bubble sort

Accessing an element of an array

Which is not a characteristic of an NP-complete problem?

All NP-complete problems can be solved efficiently.

Which of the following statements is true with reference to searching algorithms?

Binary search starts from the center of a sorted list.

The process of providing only the essentials and hiding the details is known as _____.

abstraction

An algorithm's _____ is the scenario where the algorithm does the minimum possible number of operations.

best case

Complexity analysis helps in avoiding algorithms with _____.

high memory usage

Which of the following statements is correct?

Every data structure has a specific algorithm to implement a certain operation.

Which of the following is a constant time operation?

Finding the sum of two numbers input by the user

A stack abstract data type (ADT) is implemented using a(n) _____ data structure. array linked list heap binary search tree

linked list

Which XXX should replace the missing statement in the selection sort algorithm given below? <code>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 } }</code> list[mimIndex] = list[ctr2] list[ctr1] = list[mimIndex] list[ctr2] = list[mimIndex] list[mimIndex] = list[ctr1]

list[ctr1] = list[mimIndex]

In a linked list, each node stores a _____ the next node.

pointer to

Appending an element in an array involves increasing the array's

size

In a recursive function, the base case _____ the function.

terminates

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

the maximum

Which of the following statements is true with reference to searching?

Linear search will compare all elements if the search key is not present.

Which of the following is an example of a recursive function? MySalaryCalculator(tempSal) { if (tempSal <= 500) return -1 else tempSal = tempSal + 1000 } MySalaryCalulator(tempSal) { if (tempSal <= 500) return -1 else MySalaryCalculator(tempSal - 500) } MySalaryCalculator(tempSal) { if (tempSal <= 500) return -1 else print(tempSal) } MySalaryCalculator(tempSal) { if (tempSal >= 500) return -1 else tempSal = tempSal + 1000 }

MySalaryCalulator(tempSal) { if (tempSal <= 500) return -1 else MySalaryCalculator(tempSal - 500) }

An algorithm that uses a constant number k of integer variables to find a number list's minimum value has space complexity S(N) = _____ and auxiliary space complexity S(N) = _____.

N, k

The Big O notation of the algorithm 7+12N+3N2 is _____. 7 12N 3N^2 N^2

N^2

The Big O notation of the algorithm is 7+12N+3N2 _____.

N^2

The Big O notation for an algorithm with exactly 50 constant time operations is _____.

O(1)

Which is the worst case runtime for a quicksort algorithm?

O(Nlog(N))

Which list is sorted into ascending order? Sally, Sam, Sandy, Samantha, Sal Ral, Reece, Rita, Ryan Don, Dan, Dale, Dana Alan, Andy, Al, Adam

Ral, Reece, Rita, Ryan

Which XXX completes the following insertion sort algorithm to sort in descending order? <code>for (i = 1; i < numbersSize; ++i) { j = i XXX { temp = numbers[j] numbers[j] = numbers[j - 1] numbers[j - 1] = temp --j } }</code> while(j > 0 && numbers[j] < numbers[j-1]) while(j > 0 && numbers[j] > numbers[j-1]) while(j > 0 && numbers[j] < numbers[j+1]) while(j > 0 && numbers[j] > numbers[j+1])

while(j > 0 && numbers[j] < numbers[j-1])

Given the list (xlsx, xls, xlr, txt, ods), what is the order of the elements after completing insertion sort's second outer loop iteration? xls, xlsx, xlr, txt, ods txt, xlr, xls, xlsx, ods xlr, xls, xlsx, txt, ods ods, txt, xlr, xls, xlsx

xlr, xls, xlsx, txt, ods

he lower bound of an algorithm's runtime complexity is _____.

T(N)=Ohmega(f(N))

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

The list of employees' salaries

In a computational problem for finding the highest salary of an employee in a company, what is the input? The list of employees' salaries The number of employees The highest salary The computation of the highest salary

The list of employees' salaries


संबंधित स्टडी सेट्स

Chapter 3: Collecting Objective Data: The Physical Examination

View Set

Chapter 12 AIS, Accounting Information Systems Chapter 13, Chapter 14 AIS Production Cycle, Chapter 15 AIS, Chapter 16 AIS

View Set

wildlife managment and hunting ethics

View Set

BIOL 2401 Unit #3 Lecture Exam Ch. 11

View Set