Which sorting algor…
 
Notifications
Clear all

Which sorting algorithm is the best?

5 Posts
6 Users
2 Likes
405 Views
0
Topic starter

Which sorting algorithm is the best?

riyaponraj riyaponraj 03/04/2023 6:46 pm

@jisha-c quick sort in most cases.

4 Answers
1

I would say that bubble sort is the best as it has the least time complexity

1

Bubble,Insertion, Selection sort have a time complexity of O(n^2), merge sort and quick sort are better as they have time complexity of O(n.logn).

0

Quicksort

image alt

Quicksort is one of the most efficient sorting algorithms, and this makes of it one of the most used as well. The first thing to do is to select a pivot number, this number will separate the data, on its left are the numbers smaller than it and the greater numbers on the right. With this, we got the whole sequence partitioned. After the data is partitioned, we can assure that the partitions are oriented, we know that we have bigger values on the right and smaller values on the left. The quicksort uses this divide and conquer algorithm with recursion. So, now that we have the data divided we use recursion to call the same method and pass the left half of the data, and after the right half to keep separating and ordinating the data. At the end of the execution, we will have the data all sorted.

Main characteristics:

  • From the family of Exchange Sort Algorithms
  • Divide and conquer paradigm
  • Worst case complexity O(n²)

image alt

0

Quicksort is one of th sorting algorithmse most efficient, and this makes of it one of the most used as well. The first thing to do is to select a pivot number, this number will separate the data, on its left are the numbers smaller than it and the greater numbers on the right.

Share: