TLE error showing.
SORTING IN LINEAR TIME
@Sakshi_Suman if simply using selection sort will give you All Clear then there isn’t any meaning of giving array containing only 0 1 and 2. there is some reason why array only contains 0 1 and 2 try to use it in your code.
then,tell me how to do it
use binary search. check if mid element is 0 swap it with the front if it is 2 swap it with the last.else if it is 1 just increase mid.
try implementing like this, if got any problem let me know.
did it!
…
nice
. mark this doubt as resolved if you don’t have any further queries.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.