Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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.

?? * Prints all the items in the hashtable to the Printstream supplied. * The items are printed in the order determined by the index of the hashtable *where they are stored (starting at and going to (table size 1)). The values at each index are printed according to the order in the * LinkedList starting from the beginning. @param out the place to print all the output k * public void dump (Printstream out) t Printstream pt- new PrintStream(out); pt.println("Hashtable contents: "). int index e for (LinkedList 1: hashTable) f if (1 != null) { 11.1 pt.print (index + ": "); pt.print(1 + " "); index++

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)