Consider the hash table-based algorithm (shown below) discussed in class to determine the longest contiguous subsequence of length greater than one in a sorted array of integers.
Algorithm
Insert the elements of A in a hash table H
Largest Length = 1
for i = 0 to n-1 do
if (A[i] – 1 is not in H) then
j = A[i] // A[i] is the first element of a possible cont. sub seq.
j = 1 + 1
while (j is in H) do
j = 1 + 1 end
while
if ( 3 – A[i] > 1) then // we have found a cont. sub seq. of length > 1
Print all integers from A[i] ... (1-1)
if (Largest Length Largest Length = 1 - A[i]
end if
end if
end if
end for
Show the execution of the algorithm on the following array of '10' integers and determine the output (resulting from the Print operation in the pseudo code) as well as count the number of hash table 'searches' made.
36 36 35 34 33 32 32 33 32 32