please can any one say the number of iterations for all sorting methods ...that is for bubble sort,selection sort,insertion sort,quick sort ,merge sort,heapsort ....

please reply soon....

Recommended Answers

All 2 Replies

Sounds like homework. Why don't you implement all of those algorithms and add logic to count the iterations? It's not hard. I'll even give you a link to a page with code for all of the algorithms you specified.

The number of iterations needed to sort, will vary considerably depending on the number of items there are to sort, as well as the algorithm you choose.

Even a non-comparison sorting algorithm like Counting Sort, will have to iterate through once, for each item to be sorted.

It's very instructive to count them up, for say 25 or 100 items. You'll be surprised at the variances between algorithms, in iterations, comparisons made, and swaps made.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.