search
Log In

Sorting [closed]

0 votes
150 views
Let P be a Quicksort Program to sort numbers in ascending order using the first element as
pivot. Let t1 and t2 be the number of comparisons made by P for the inputs {1, 2, 3, 4, 5} and {4,1, 5, 3, 2} respectively. Which one of the following holds?
A. t1 = 5 B. t1< t2
C. t1> t2 D. t1 = t2
closed with the note: solved this..
in Algorithms
closed by
150 views

Related questions

1 vote
1 answer
1
740 views
An array $A$ of size n is known to be sorted except for the first $k$ elements and the last $k$ elements, where $k$ is a constant. Which of the following algorithms will be the best choice for sorting the array $A?$ $a)$Insertion Sort $b)$Bubble sort $c)$Quicksort ... ? Quick Sort sorts part by part using pivot. So, why not will it be answer?? How do we know it is asking for almost sorted array??
asked May 12, 2019 in Algorithms srestha 740 views
1 vote
1 answer
2
370 views
I’ve seen this wikipedia article – https://en.wikipedia.org/wiki/Comparison_sort Also see this link – https://gateoverflow.in/32948/minimum-number-of-comparisons https://gateoverflow.in/95725/algorithm-minimum-comparison-sorting#a95826 Even Wikipedia gives 2 answers as 33 and 34. So, which one is correct? And how 34 is coming? Yes 33 comparison are coming from but how can one say 34 comparison.
asked May 4, 2019 in Algorithms iarnav 370 views
0 votes
2 answers
3
542 views
I did Google and found out that Quicksort is better then Mergesort, but my question is which is faster among both?
asked Apr 25, 2019 in Algorithms iarnav 542 views
0 votes
3 answers
4
815 views
why not merge sort?we don’t swap in merge sort,we just create auxillary arrays and merge them by changing elements in the original array.should we consider that as a swap?
asked Apr 16, 2019 in Algorithms hitesh159 815 views
...