We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
A very nice read indeed. I went through a few more lectures to make myself clear on this topic, especially because I seem to have received a lot of downvotes on my comment. https://wiki.python.org/moin/TimeComplexity
So to clear my side of the argument, I would like you to go through the above link where they mention the average case being O(1) and (amortized) worst case for dictionary access being O(n). https://stackoverflow.com/questions/2771368/can-hash-tables-really-be-o1
Also, the accepted answer in the above link mentions the exact reasons for this worst case i.e. failing assumptions.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Count Triplets
You are viewing a single comment's thread. Return to all comments →
A very nice read indeed. I went through a few more lectures to make myself clear on this topic, especially because I seem to have received a lot of downvotes on my comment.
https://wiki.python.org/moin/TimeComplexity
So to clear my side of the argument, I would like you to go through the above link where they mention the average case being O(1) and (amortized) worst case for dictionary access being O(n).
https://stackoverflow.com/questions/2771368/can-hash-tables-really-be-o1
Also, the accepted answer in the above link mentions the exact reasons for this worst case i.e. failing assumptions.