Question
Banks often record transactions on an account in order of the times of the transactions, but many people like to receive their bank statements with
-
Banks often record transactions on an account in order of the times of the transactions, but many people like to receive their bank statements with checks listed in order by check number. People usually write checks in order by check number, and merchants usually cash them with reasonable dispatch. The problem of converting time-of-transaction ordering to check-number ordering is therefore the problem of sorting almost-sorted input. What sorting algorithm would work best for this case?
Insertion sort algorithm Merge-Sort algorithm Heap-Sort algorithm Quick-Sort algorithm Counting-Sort algorithm
-
In Quick-Sort, the last element is chosen as a pivot element. If a list is sorted already, a pivot will be always the largest number in the list and the algorithm runs O(n2). How can we solve this problem?
Use divide-and-conquer algorithm Use incremental algorithm Use randomized algorithm Use dynamic programming None of the above
-
Suppose we should write a program to sort an array of integers, where different integers may have different numbers of digits, but the total number of digits over all the integers in the array is n. What sorting algorithm should we consider to use for this scenario?
Quick sort Bucket sort and Counting sort Bucket sort and Radix sort Bucket sort and Insertion sort None of the above
-
Suppose we should write a program to sort in place, using no more than a constant amount of storage space in addition to the original array. What sorting algorithms should we avoid?
Counting sort Radix sort Bucket sort Merge sort All of the above
-
How many comparisons are required to sort an array of length 10 if insertion sort algorithm is used and the array is already sorted?
9 10 15 20 None of the above
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started