+ 1

Sorting Algorithm

I am familiar with many sorting algorithms that have the following time complexities: O(n²) for both ascending and descending order O(log n) for both ascending and descending order O(2n) or O(n) for ascending order only I'm looking for a sorting algorithm that has a time complexity of O(n) and can sort in both ascending and descending order. Could you suggest one?

27th Sep 2024, 10:10 AM
LORD HOSSEIN
LORD HOSSEIN - avatar
2 Réponses
+ 2
Where are you gping to use this O(n) sort algorithm ? will you be using a linked list or array ? Based on these answers I can recommend something relevant.
27th Sep 2024, 10:27 AM
Morpheus
Morpheus - avatar
+ 1
Morpheus I typically use arrays because they allow faster access and modification of elements
27th Sep 2024, 10:33 AM
LORD HOSSEIN
LORD HOSSEIN - avatar