GATEverse
← GATE CSE 2000

Q15

MCQMarks unknown

Suppose you are given arrays p[1......N]p [1......N] and q[1......N]q [1......N] both uninitialized, that is, each location may contain an arbitrary value), and a variable count, initialized to 00. Consider the following procedures setset and is_setis\_set: set(i) { count = count + 1; q[count] = i; p[i] = count; } is_set(i) { if (p[i] ≤ 0 or p[i] > count) return false; if (q[p[i]] ≠ i) return false; return true; }

Sign in to save attempts.

Loading…