Exam 3: Searching, Sorting, and Complexity Analysis
Exam 1: Basic Python Programming51 Questions
Exam 2: An Overview of Collections50 Questions
Exam 3: Searching, Sorting, and Complexity Analysis50 Questions
Exam 4: Arrays and Linked Structures50 Questions
Exam 5: Interfaces, Implementations, and Polymorphism50 Questions
Exam 6: Inheritance and Abstract Classes50 Questions
Exam 7: Stacks50 Questions
Exam 8: Queues50 Questions
Exam 9: Lists50 Questions
Exam 10: Trees50 Questions
Exam 11: Sets and Dictionaries50 Questions
Exam 12: Graphs50 Questions
Select questions type
What should the missing code be in the following algorithm if the goal is to determine how many seconds the algorithm runs? start = time.time()
MyCount = 1
For x in range(100):
MyCount *= x
Elapsed = time.time() - < missing code >
(Multiple Choice)
4.8/5
(40)
Which of the following is a method to estimate the efficiency of an algorithm that predicts the amount of work an algorithm performs regardless of the platform?
(Multiple Choice)
4.9/5
(45)
In the following code, what is the algorithm's complexity? minIndex = 0
CurrentIndex = 1
While currentIndex < len(lyst):
If lyst[currentIndex] < lyst[minIndex]:
MinIndex = currentIndex
CurrentIndex += 1
Return minIndex
(Multiple Choice)
4.8/5
(33)
Which method of determining the efficiency of algorithms allows you to rate them independently of timings or instruction counts?
(Multiple Choice)
4.9/5
(30)
In the first step of the quicksort, you begin by selecting the item at the list's midpoint.
(True/False)
4.9/5
(44)
What should the missing code be in the following insertion sort algorithm? i = 1
While i < len(myList):
ItemToInsert = myList[i]
J = i - 1
While j >= 0:
If itemToInsert < myList[j]:
MyList[j + 1] = myList[j]
J -= 1
Else:
Break
< missing code >
I += 1
(Multiple Choice)
4.9/5
(43)
In terms of complexity, what is the average case for an insertion sort?
(Multiple Choice)
4.9/5
(36)
Algorithms with linear behavior do more work than those with quadratic behavior.
(True/False)
4.8/5
(38)
Using a binary search, a list of 1 million items requires only 20 comparisons.
(True/False)
4.7/5
(39)
How can the performance complexity of the following algorithm be described?
For x in range(numIterations):
Value = value * x
Print(value)
(Multiple Choice)
4.8/5
(35)
In the average case, where many items in a list are out of order, an insertion sort is linear.
(True/False)
4.7/5
(42)
This bubble sort has the effect of bubbling the largest items to the end of the list.
(True/False)
4.9/5
(31)
In a binary search of an ascending order list, where does the search algorithm begin the search?
(Multiple Choice)
4.8/5
(44)
Which type of algorithm is analogous to how many people organize playing cards in their hands?
(Multiple Choice)
4.9/5
(38)
In terms of complexity, what is the worst-case scenario for an insertion sort?
(Multiple Choice)
4.9/5
(32)
The sequential search algorithm does more work to find a target at the beginning of a list than at the end of the list.
(True/False)
4.8/5
(43)
Showing 21 - 40 of 50
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)