1|Page
DTSA 5501 - ALGORITHMS FOR SEARCHING,
SORTING, AND INDEXING NEWEST ACTUAL
VERIFIED EXAM || MOST RECENT EXAM ACTUAL
COMPLETE REAL EXAM QUESTIONS AND CORRECT
ANSWERS (VERIFIED ANSWERS)||NEWEST EXAM!!!
the decision to choose a particular sorting algorithm
should be made based on - Answer-run-time efficiency of
the sort, size of the array, and space efficiency of the
algorithm (I, II, AND III)
the following code fragment does a sequential search to
determine whether a given integer, value, is stored in an
array[0]... a[n-1] - Answer-i < n && value!= a[I]
a feature of data that is used for a binary search but not
necessarily used for a sequential search is - Answer-order
of data
array unsortedArr contains an unsorted list of integers.
array sortedArr contains a sorted list of integers. which of
the following operations is more efficient for sortedArr than
unsovtedarr? Assume the most efficient algorithms are
used. - Answer-searching for a given element
,2|Page
an algorithm for searching a large sorted array for a
specific value x compares every third item in the array to x
until it finds one that is greater than or equal to x. when a
larger value is found, the algorithm compares x to the
previous two items. if the array is sorted in increasing
order, which of the following describes all cases when this
algorithm uses fewer comparisons to find x than would a
binary search? - Answer-when x is very close to the
beginning of the array
assume that a[0]...a[n-1] is an array of N positive integers
and that the following assertion is true:
a[0] > a[k] for all K such that 0<k<N
which must be true? - Answer-a[0] holds the largest value
the following code is designed to set index to the location
of the first occurrence of the key in array a and to set
index to -1 if key is not in a.
index=0;
while(a[index] != key)
index++;
if(a[index] != key)
, 3|Page
index = -1;
in which case will this program definitely fail to perform the
tax described - Answer-when key is not in the array
if an array of Integer contains the following elements what
would the array look like after the third pass of
selectionSort, sorting from high too low?
89 42 -3 13 109 70 2 - Answer-109 89 70 13 42 -3 2
assuming that the method works as intended, which o the
following should be added to the precondition of search? -
Answer-v is sorted smallest to largest
a binar search will bar performs on the following list
a[0] a[1] a[2] a[3] a[4] a[5] a[6] a[7]
4. 7. 9. 11. 20. 24. 30. 41
to find the key value 27, the search interval after the first
pass through the while loop will be - Answer-a[4]....a[7] (C)
how many iterations will be required to determine that 27
is not in the list? - Answer-3 (B)
DTSA 5501 - ALGORITHMS FOR SEARCHING,
SORTING, AND INDEXING NEWEST ACTUAL
VERIFIED EXAM || MOST RECENT EXAM ACTUAL
COMPLETE REAL EXAM QUESTIONS AND CORRECT
ANSWERS (VERIFIED ANSWERS)||NEWEST EXAM!!!
the decision to choose a particular sorting algorithm
should be made based on - Answer-run-time efficiency of
the sort, size of the array, and space efficiency of the
algorithm (I, II, AND III)
the following code fragment does a sequential search to
determine whether a given integer, value, is stored in an
array[0]... a[n-1] - Answer-i < n && value!= a[I]
a feature of data that is used for a binary search but not
necessarily used for a sequential search is - Answer-order
of data
array unsortedArr contains an unsorted list of integers.
array sortedArr contains a sorted list of integers. which of
the following operations is more efficient for sortedArr than
unsovtedarr? Assume the most efficient algorithms are
used. - Answer-searching for a given element
,2|Page
an algorithm for searching a large sorted array for a
specific value x compares every third item in the array to x
until it finds one that is greater than or equal to x. when a
larger value is found, the algorithm compares x to the
previous two items. if the array is sorted in increasing
order, which of the following describes all cases when this
algorithm uses fewer comparisons to find x than would a
binary search? - Answer-when x is very close to the
beginning of the array
assume that a[0]...a[n-1] is an array of N positive integers
and that the following assertion is true:
a[0] > a[k] for all K such that 0<k<N
which must be true? - Answer-a[0] holds the largest value
the following code is designed to set index to the location
of the first occurrence of the key in array a and to set
index to -1 if key is not in a.
index=0;
while(a[index] != key)
index++;
if(a[index] != key)
, 3|Page
index = -1;
in which case will this program definitely fail to perform the
tax described - Answer-when key is not in the array
if an array of Integer contains the following elements what
would the array look like after the third pass of
selectionSort, sorting from high too low?
89 42 -3 13 109 70 2 - Answer-109 89 70 13 42 -3 2
assuming that the method works as intended, which o the
following should be added to the precondition of search? -
Answer-v is sorted smallest to largest
a binar search will bar performs on the following list
a[0] a[1] a[2] a[3] a[4] a[5] a[6] a[7]
4. 7. 9. 11. 20. 24. 30. 41
to find the key value 27, the search interval after the first
pass through the while loop will be - Answer-a[4]....a[7] (C)
how many iterations will be required to determine that 27
is not in the list? - Answer-3 (B)