Question: A variation on sequential search finds the k^th last occurrence of a key in a list. For example, given the list {1, 6, 3, 9,
A variation on sequential search finds the k^th last occurrence of a key in a list. For example, given the list {1, 6, 3, 9, 3, 4, 5, 3, 0}, the 1^st last occurrence of 3 is in location 8, the 2^nd last occurrence of 3 is found at location 5, the 3^rd last occurrence of 3 is in location 3. Write an algorithm seqSearchKthLast(list, n, k, key) that searches list, of size n, for the k^th last value of key. What is the best case time complexity of your algorithm? Justify your
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
