Docsity

Data Structures & Algorithms Latest Chapter 4 Questions, Exams of Data Structures and Algorithms

Toggle sidebar
bg1
Data Structures & Algorithms Latest
Chapter 4 Questions and Answers
A programming algorithm is like: - A recipe
An algorithm always leads to a(n): - Solution
An algorithm is written down as: - A list of steps
An algorithm tests the air pressure on a slope at different altitudes. Given
that the pressure depends on the altitude, what is the optimal algorithmic
function to use? - Linear
An experimental analysis depends on the _____ results, so an algorithm
cannot be measured unless an _____ is implemented. - output; equivalent
program
Brian has an algorithm to read through an array that contains numbers 1
through 26 and convert each number to an English alphabet. He runs the
algorithm a number of times with no changes to the size of the array and no
changes to the task done. The function to use is: _____ - f(n) = c
Contrapositive and contradiction fall under which category of algorithm
analysis? - Contra Attack
For a linear function, what would be its time complexity? - O(N)
pf3

Partial preview of the text

Download Data Structures & Algorithms Latest Chapter 4 Questions and more Exams Data Structures and Algorithms in PDF only on Docsity!

Data Structures & Algorithms Latest

Chapter 4 Questions and Answers

A programming algorithm is like: - A recipe An algorithm always leads to a(n): - Solution An algorithm is written down as: - A list of steps An algorithm tests the air pressure on a slope at different altitudes. Given that the pressure depends on the altitude, what is the optimal algorithmic function to use? - Linear An experimental analysis depends on the _____ results, so an algorithm cannot be measured unless an _____ is implemented. - output; equivalent program Brian has an algorithm to read through an array that contains numbers 1 through 26 and convert each number to an English alphabet. He runs the algorithm a number of times with no changes to the size of the array and no changes to the task done. The function to use is: _____ - f(n) = c Contrapositive and contradiction fall under which category of algorithm analysis? - Contra Attack For a linear function, what would be its time complexity? - O(N)

If an algorithm runs in quadratic time, what is its time complexity using Big-O ? - O(N2) If f(n) is the function then O(f(n)) = { g(n) : there exists c > 0 and n0 such that f(n) ≤ c.g(n) for all n > n0. } is true for which of the following symptotic notations? - Big Oh If one for loop runs with size N and the other with size M and the loops follow a linear function, what is the expected time complexity? - O(M+N) In a linear function, the time taken is _____ if the size of the input is doubled.

  • doubled In algorithm analysis, space complexity describes _____. - the total memory space consumed In loop variants, the relationship between the variables _____. - is the same before and after the loops Instead of a list of steps, algorithms can be written using: - Flowcharts with arrows to illustrate the journey Kara's code includes a binary search operation. Which of the following functions would be optimal to test the execution time of this function? - Log n Out of a random bunch of last years' holiday greeting cards, Clara wants to find the one her mother sent her. The optimal algorithm to use will be _____. - N-log-N The ingredients in an algorithm are called: - Inputs