Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

speed of hash table searching?  RSS feed

 
yamini nadella
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the speed of the hashTable seach like O(log n) or what?
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, isn't that information already in the Javadocs.

Second, you don't need to know the speed of a hashtable for the SCJP exam. So I am going to move this to the Java In General (Beginner) forum.

Mark
 
Jeff Langr
author
Ranch Hand
Posts: 799
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't believe that information is in the Javadoc, but I could've missed it.

It's O(1), optimally, but can degrade to O(n). (See http://en.wikipedia.org/wiki/Hashtable for further info.)

-Jeff-
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The javadoc for Hashtable doesn't say anything about the speed, while the javadoc for HashMap does. ("This implementation provides constant-time performance for the basic operations...") Of course, the javadoc for hashTable doesn't exist at all, so perhaps this is a moot point.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!