jump to navigation

Big O for collections April 8, 2013

Posted by javafoo in java, java interview.
trackback

Yes, if you claim 10+ years of java experience and fumble/fudge on Big O complexity for collections, you are out. So please understand/read up on that. Happened to me, could get all the design patterns, OOPs, architecture level questions right, but fumbled on big O and the interviewer was like mmm…ok then, I don’t have any more questions, see you. I so want to jump in a well, even I wouldn’t hire myself. No, a map does not have O(n) complexity, it has closer to O(1) complexity or more if there are collisions. See here:

http://www.leepoint.net/notes-java/algorithms/big-oh/bigoh.html

Comments»

1. Jake Radakovich - April 8, 2013

It’s sad. I use Java Collections all day, and I don’t think I could give you a definitive answer on the Big O of the various collections. Efficiency is important, but I normally don’t think of it in terms of Big O – just this implementation is faster than that implementation for this task.

javafoo - April 23, 2013

That is so true. It does make sense now when I read up on that, but when I was in undergrad doing datastructures and algorithms in class, this was sleep inducing stuff.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: