'How to sort array in constant time in java and python?

I was trying to learn algos and data structures, and i was wondering about best approach to sort arrays in constant time.

I am newbie but my only intention is to get insight on this very fundamental thing to get familiar with how things work.

Or if anyone can add value to my question or on my knowledge of problem solving



Solution 1:[1]

Well, if arrays could be sorted in constant time, the world will change for good.

As per my knowledge, the lowest time a sorting algorithm can sort in linear O(n) like count sort which is inefficient for data with large values.

You should try understanding what exactly does time in a time complexity indicate; that'll give you an idea of your question and how and why it's not possible as of now.

The best you can get as of now are Merge Sort and Quick Sort with O(nlogn) time complexity which are efficient.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1