jQuery in Action, 3rd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes difference between sorting and ordering Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "difference between sorting and ordering" Watch "difference between sorting and ordering" New topic

difference between sorting and ordering

vijay umar
Ranch Hand

Joined: Mar 24, 2009
Posts: 100
het every one!

i have a small confusion related to the difference between sorting and ordering?

i think ordering and sorting means the same? isnt it?

if you see ordering it means that the array is in a particular order wether it is like large to small or somthing like that!

and if you take sorting it also means almost same that you sort the array in an ascending or descending order?

i am right ? please intimate where i went wrong?
avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 453

ordering : it means there is a proper way you can predict the transversal of the content of a data holder like fifo or lifo
Sorting : it is a type of ordering which adheres some special ordering algorithm apart from the insertion order. like ascending or descending

the key part is that ordering doesn't depend upon the property of the element inserted but sorting does.

for ex in ascending ith element <i+1th element

SCJP 5.0 SCWCD 5.0
vijay umar
Ranch Hand

Joined: Mar 24, 2009
Posts: 100
thanks !

i am now clear about it!
Ankit Garg

Joined: Aug 03, 2008
Posts: 9465

Since sorting is a type of ordering, so when a collection is sorted, it is automatically ordered. You might face a question asking if a sorted collection is automatically ordered (which is true) or if an ordered collection is automatically sorted (which is false)...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
I agree. Here's the link: http://aspose.com/file-tools
subject: difference between sorting and ordering
It's not a secret anymore!