Vishal Hegde wrote: . . .
1 ,2,3,4,5,6,7,8,9, they are in Order right and sorted in ascending Order or
A,B,C,D,E,G,H etc is also ordered right and also sorted in ascending order . . .
You can’t tell whether those are ordered.
If you created the first series like this:
add(1) add(9) add(2) add(8) add(3) add(7) add(4) add(6) add(5), then they are out of order.
“Sorted” is a
word with a precise meaning, but “ordered” isn’t. By saying ordered you usually mean in the same order that elements were inserted. But you can insert elements into a List in locations earlier than elements already in the list, eg using
add(1, E);