answersLogoWhite

0

The average no of comparisons needed to sort 3 no?

Updated: 8/17/2019
User Avatar

Wiki User

14y ago

Best Answer

Best case: 2

Worst case: 3

Average: 2+2/3

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: The average no of comparisons needed to sort 3 no?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How many credits are needed for a 3 year college program?

On average I think it is 12 credits needed for a 3 year college.


What is the difference between insertion sort and selection sort?

Both bubble sort and selection sort are in-place sorts, which means they require no additional space to sort. Both are O(n). Both also share worst/average case time complexities of O(n2). Selection sort also has O(n2) for a best case scenario, while an intelligent bubble sort implementation will have O(n) for a best case (already sorted) scenario. Note that while looking at the numbers above seem to show that bubble sort has a slight edge over selection sort, in practice you should choose selection over bubble. It will very nearly always perform better in real-time tests.


How do i find the average of 42?

Two or more numbers are needed to find the average then you add them up then divide them by how many there are as for example the average of 2+4+6 = 12 and so 12/3 = 4 which is the mean average


How may beta coefficients be used to standardize the returns for risk to permit comparisons of mutual fund performance?

3


Comparison of adjectives?

Comparisons of Adjective: 1.Positive 2Comparative 3.Superlative


How may beta coefficients be used to standardize returns for risk to permit comparisons of mutual fund performance?

3


How long is on average is cheddar cheese aged for?

A minimum of 3 months is needed but can be up to 30 months. The longer it is aged the "sharper" it becomes.


What is needed for The Sims 3?

A hell of a PC is needed for The Sims 3!


How do you program c plus plus to arrange 3 numbers in ascending order using swap?

void sort (int& a, int& b, int& c) { if (a>b) std::swap (a, b); if (b>c) std::swap (b, c); else return; if (a>b) std::swap (a, b); } Note that this is based upon a bubble sort algorithm. Although usually inefficient as a general sorting algorithm, given that we know there are only three elements means we can implement it reasonably efficiently without any additional space complexity. There will always be 2 or 3 comparisons but at most there will be 3 swaps. The only improvement we could really make is to implement a type of selection sort: void sort (int& a, int& b, int& c) { if (a>b && a>c) std::swap (a, c); else if (b>c) std::swap (b, c); if (a>b) std::swap (a, b); } Here we either make 3 or 4 comparisons but only 2 swaps at most. The assumption here is that a comparison is a quicker operation than a swap thus the selection sort method is more efficient. However, unless you were to sort millions of sets of three one after the other, you are unlikely to see any measurable difference in performance.


What is the Average breathing rate of tropical fish per minute?

it is sort of different for all fishes .for example a sperm whale breaths 3-4 times per minute


How do you compare 2 thirds 3 fourths and 3 fifths?

3/4 - 2/3= you make common denominators... 9/12 - 8/12 = 1/12 There is how you do all three comparisons...


What is an average number of iterations to sort 3 elements?

If you're only sorting 3 elements, it should take you 0 to 2 iterations. Of course, this answer might change if you're trying test out a scalable sorting algorithm.