1. What is the worst-case complexity of your dump() method as shown below? Brief
ID: 3704015 • Letter: 1
Question
1. What is the worst-case complexity of your dump() method as shown below? Briefly explain
the answer, making sure to identify the problem size(s). Thanks!!!
2. Suppose insert an item into hashtable and then immediately do a
lookup on that item using insert() and lookup() shown below. What is the worst-case complexity of your program in this
situation? Briefly explain the answer.
Explanation / Answer
Hi Dear,
I have answered Q1. As per the chegg guideline, please repost others in separate post.
Time Complexity of dump() method:
We have one FOR loop inside dump() method : iterating over hash table
So, lets say, there are N elements in the hash table, hence FOR loop runs N times
So, Worst Case time complexity: O(N)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.