True or False Dictionaries and Hashing – Correct answerupvoted.
a) If a dictionary is implemented using an unsorted linked list,then find and removeboth requireO(n){“version”:”1.1″,”math”:”( mathcal{O}(n) )”} time in theaverage and worst case, but insert isO(1){“version”:”1.1″,”math”:”( mathcal{O}(1) )”}because newitems can simply be inserted onto the beginning or end of thelist.
b)For a dictionary implemented as a sorted array-based list,find can be performed inO(logn){“version”:”1.1″,”math”:”( mathcal{O}(log ; n) )”} time,but insert and remove becomeO(n){“version”:”1.1″,”math”:”( mathcal{O}(n) )”} because of theneed to shift items in the array to keep them in sorted order.
Solution
a) Find takes O(n) time but removing a node
OR
OR