• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Treemap sorting O-notation ?

 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorting resultsets via an integer key using TreeMap.
Does anyone know the O-notation for the data structure
in TreeMap which is a sorted Map ADT.
Thanks
Gavin
 
Angela Lamb
Ranch Hand
Posts: 156
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using the Collections.sort() method, then this quote from the API will answer your question:

The sorting algorithm is a modified mergesort (in which the merge is omitted if the highest element in the low sublist is less than the lowest element in the high sublist). This algorithm offers guaranteed n log(n) performance, and can approach linear performance on nearly sorted lists.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic