Which of the following sort algorithms is represented by the pseudocode?

for all elements of list

if list[i] > list[i+1]

swap(list[i], list[i+1])

end if

end for
(1 point)
Responses

merge sort
merge sort

bubble sort
bubble sort

selection sort
selection sort

quicksort
quicksort

7 answers

The pseudocode provided is representative of bubble sort. In bubble sort, the algorithm repeatedly steps through the list, compares adjacent items, and swaps them if they are in the wrong order. This process is repeated until the list is sorted. The key aspect here is the comparison of each element with its next neighbor, which is characteristic of bubble sort.

Therefore, the correct response is:

bubble sort

Which of the following search algorithms is represented by the pseudocode?

index = 0

WHILE (index < number of items in the list)

{

IF (list[index] == target element)

{

RETURN index

}

index = index+1

}
(1 point)
Responses

linear search
linear search

quicksort
quicksort

hashing
hashing

binary search

The pseudocode provided represents a linear search algorithm. In a linear search, the algorithm iterates through each element of the list sequentially, checking if the current element matches the target element. If a match is found, it returns the index of that element. This is done until all elements have been checked or the target element is found.

Therefore, the correct response is:

linear search

Which of the following is described as a process by which a problem is divided into subproblems which are recursively solved, then recombined for a final solution? (1 point)
Responses

bubble sort algorithm
bubble sort algorithm

divide and conquer algorithm
divide and conquer algorithm

selection sort algorithm
selection sort algorithm

binary search algorithm

The process described as dividing a problem into subproblems that are recursively solved and then recombined for a final solution is known as the divide and conquer algorithm. This approach is commonly used in various algorithms, such as merge sort and quicksort.

Therefore, the correct response is:

divide and conquer algorithm

Which of the following is a classic algorithm applied to modern cryptography?(1 point)
Responses

modular arithmetic
modular arithmetic

binary sort
binary sort

linear search
linear search

pseudorandom number generator

Among the options provided, modular arithmetic is a classic algorithm that is heavily applied in modern cryptography. It plays a critical role in various cryptographic algorithms, including RSA encryption and other public key cryptographic methods.

Therefore, the correct response is:

modular arithmetic