Quote:
i read too many methods for this purpose but now i am confused bcz some methods are good but they are not workable in all conditions so i need a good and easy method which works in all situation even if we don't know the length of array
There is no method that can sort an array without knowing its size.
There is no magic method that can guess what is in your head.
Whatever the sort method you use, there is a time where you have to explain what you want you sort and how, no matter what.
Quote:
please write at least one program only which solves any problem about this topic
I am waiting
As already said, there is no such magic method.
Quote:
i tried many methods and they are very long and complex that's why i need a simple and understandable method which saves my time
Supposing you are a good programmer:
- the most simple methods will be inefficient and perform poorly.
- the most efficient methods will be complex.
There is a special case for bad programmers that can have complex methods that are inefficient.
Example: you have to sort a list of millions of numbers, all of them are same number of digits.
Without any complementary information, it is a huge task, whatever the method used.
If you know they are the phone numbers of your country, it is a special case which allow a method specially tailored for this case and it will out perform any other method.