2017 January NTA UGC NET Paper 1
November 4, 2023NTA UGC NET JUNE-2023 Paper-2
November 4, 2023NTA UGC NET JUNE-2023 Paper-2
Question 1
|
1,3,8,10,5,_,_
|
|
3,8,1,_,10,_5
|
|
_,3,8,1,_,10,5
|
|
_1,3,8,10,5,_
|
Insert 1:
Hash value = (6 * 1 + 3) mod 4 = (6 + 3) mod 4 = 9 mod 4 = 1
Table: _, 1, _, _, _, _, _
Insert 3:
Hash value = (6 * 3 + 3) mod 4 = (18 + 3) mod 4 = 21 mod 4 = 1 (collision)
Since the slot at index 1 is already occupied, we’ll perform linear probing (moving to the next slot until we find an empty one).
Table: _, 1, 3, _, _, _, _
Insert 8:
Hash value = (6 * 8 + 3) mod 4 = (48 + 3) mod 4 = 51 mod 4 = 3
Table: _, 1, 3, 8, _, _, _
Insert 10:
Hash value = (6 * 10 + 3) mod 4 = (60 + 3) mod 4 = 63 mod 4 = 3 (collision)
Linear probing again.
Table: _, 1, 3, 8, 10, _, _
Insert 5:
Hash value = (6 * 5 + 3) mod 4 = (30 + 3) mod 4 = 33 mod 4 = 1 (collision)
Linear probing.
Table: _, 1, 3, 8, 10, 5, _
So, the content of the table after inserting the sequence 1, 3, 8, 10, and 5 is:
_, 1, 3, 8, 10, 5, _
Insert 1:
Hash value = (6 * 1 + 3) mod 4 = (6 + 3) mod 4 = 9 mod 4 = 1
Table: _, 1, _, _, _, _, _
Insert 3:
Hash value = (6 * 3 + 3) mod 4 = (18 + 3) mod 4 = 21 mod 4 = 1 (collision)
Since the slot at index 1 is already occupied, we’ll perform linear probing (moving to the next slot until we find an empty one).
Table: _, 1, 3, _, _, _, _
Insert 8:
Hash value = (6 * 8 + 3) mod 4 = (48 + 3) mod 4 = 51 mod 4 = 3
Table: _, 1, 3, 8, _, _, _
Insert 10:
Hash value = (6 * 10 + 3) mod 4 = (60 + 3) mod 4 = 63 mod 4 = 3 (collision)
Linear probing again.
Table: _, 1, 3, 8, 10, _, _
Insert 5:
Hash value = (6 * 5 + 3) mod 4 = (30 + 3) mod 4 = 33 mod 4 = 1 (collision)
Linear probing.
Table: _, 1, 3, 8, 10, 5, _
So, the content of the table after inserting the sequence 1, 3, 8, 10, and 5 is:
_, 1, 3, 8, 10, 5, _