Output of car sorting problem

in car sorting problem,for the input given in video when compare function was compared on the basis of length,why do we get safari first and then suzuki,here we are not sorting it by lexicographically ascending order right…then why do we get safari first and suzuki second for return A.car_name.length() < B.car_name.length()???

hello @kani001

check ur original array.
u might have written safari first and then suzuki thats why output is coming like this.

oh…u mean when they dont have any other criteria they just give outputs in the same order as input?

yeah . . . . . . . . . . .

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.