Logomenu

Algorithms Questions

Explore questions in the Algorithms category that you can ask Spark.E!

The linear search algorithm is also known as the _____________ _________ algorithm.

The reason -1 is returned when the search value is not found in the array is because -1 is not a ________ ______________.

Powers of __ are used to calculate the maximum number of comparisons the binary search will make on an array of any size.

The binary search doesn't test the array's first element, this algorithm starts with the element in the __________.

The binary search is much more __________ than the linear search.

What are the three different steps combined to create an algorithm?

what is the formula for linear search?

Refer to the following code segment:The procedure check is supposed to display a statement correctly comparing the size of the two provided numbers, value1 and value2. Which of the following changes to the code would be the best choice to make the procedure work as intended?

Sam's password is known to be formed of 3 decimal digits (0-9) in a given order. Karren and Larry are attempting to determine Sam's password by testing all possible combinations. If they are only able to try 10 combinations every day, how many days would it take to try all the possible combinations?

Given a list of integers, sequence, and an integer, value, which of the following best describes what the code segment does?

Lists are widely used in programming, however, lists are not necessary for all programming tasks. In which of the following situations would you be least likely to need to use a list in a program?

Which of the following decimal (base-10) values is equivalent to the binary (base-2) value 101001?

The following two algorithms are designed to find the number of integers on a list which have a value greater than 5.Algorithm I:Create a variable count and set this to zero. For each value on the list, check whether it is greater than 5. If it is, then add 1 to the value of count. When the end of the list is reached display the value of count.Algorithm II:Create a variable count and set this to the number of items on the list. For each value on the list, check whether it is smaller than 5. If it is, then subtract 1 from the value of count. When the end of the list is reached display the value of count.Which of the following statements correctly demonstrates that the two algorithms are NOT equivalent?

Below is the International Morse Code, where each letter is made up of a unique combination of dots and dashes.This code is an example of what type of encoding?

A large company uses 10-bit binary numbers to identify its employee records. It plans to change this system to use 12-bit binary numbers instead. Which of the following statements best describes the effects of this change?

The program below is intended to find and display the total when all the unique numbers on the list of integers numbers are summed (e.g. if a list contains a number twice it will only be added to the total once).The program makes use of a procedure named IsFirstOccurence. Which of the following definitions of this procedure would cause the program to function as intended?

From the following blocks, a code segment can be formed which will swap the values of the variables a and b.Which of the following gives a correct, ordered set of instructions which will create a code segment swapping the initial values of a and b?

The list mine is initialized with the values -- green, red, blue, purple, yellow, black -- and the list yours is initialized with the values -- green, red, black, blue. What will be displayed after the following code segment runs?

Consider the following code segment which makes use of the list deck and the positive integer i:Which of the following could be displayed when this segment of code is executed, assuming that the block will sort the parameter list in alphabetical order from A to Z, and the user responds to each input?

The elements of the list "months" are given below:What is the output of the following block? (Hint: think about case sensitivity.)