Exam 18: Searching and Sorting Algorithms
Exam 1: An Overview of Computers and Programming Languages50 Questions
Exam 2: Basic Elements of C++50 Questions
Exam 3: Input/Output50 Questions
Exam 4: Control Structures I (Selection)50 Questions
Exam 5: Control Structures II (Repetition)50 Questions
Exam 6: User-Defined Functions50 Questions
Exam 7: User-Defined Simple Data Types, Namespaces, and the string Type50 Questions
Exam 8: Arrays and Strings50 Questions
Exam 9: Records (structs)50 Questions
Exam 10: Classes and Data Abstraction50 Questions
Exam 11: Inheritance and Composition50 Questions
Exam 12: Pointers, Classes, Virtual Functions, Abstract Classes, and Lists50 Questions
Exam 13: Overloading and Templates50 Questions
Exam 14: Exception Handling50 Questions
Exam 15: Recursion50 Questions
Exam 16: Linked Lists50 Questions
Exam 17: Stacks and Queues50 Questions
Exam 18: Searching and Sorting Algorithms50 Questions
Exam 19: Binary Trees50 Questions
Exam 20: Graphs50 Questions
Exam 21: Standard Template Library (STL)50 Questions
Select questions type
To construct a search algorithm of the order less than log2n,it cannot be ____________________ based.
(Short Answer)
4.8/5
(42)
In the bubble sort algorithm,the following code accomplishes swapping values in elements at positions index and index + 1.
(Multiple Choice)
4.9/5
(35)
The swap function of quick sort is written differently from the swap function for selection sort.
(True/False)
4.7/5
(50)
The binary search algorithm can be written iteratively or recursively.
(True/False)
4.8/5
(42)
Assume that list consists of the following elements.What is the result after bubble sort completes? int list[] = {2,56,34,25,73,46,89,10,5,16};
(Multiple Choice)
4.7/5
(34)
Assuming the following list declaration,which element is at the position 0 after the first iteration of selection sort? int list[] = {16,30,24,7,62,45,5,55}
(Multiple Choice)
4.8/5
(38)
With the binary search algorithm,____ key comparison(s)is/are made in the successful case-the last time through the loop.
(Multiple Choice)
4.9/5
(38)
The following C++ function implements the ____________________ sort algorithm.
template <class elemType>
void Sort(elemType list[],int length)
{
for (int iteration = 1; iteration < length; iteration++)
{
for (int index = 0; index < length - iteration; index++)
{
if (list[index] > list[index + 1])
{
elemType temp = list[index];
list[index] = list[index + 1];
list[index + 1] = temp;
}
}
}
}
(Short Answer)
5.0/5
(36)
In a binary search,first,the search item is compared with the last element of the list.
(True/False)
4.8/5
(39)
In general,the selection sort algorithm is good only for small lists because ____________________ grows rapidly as n grows.
(Short Answer)
4.9/5
(37)
Showing 41 - 50 of 50
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)