Unlock using hashing

output is showing wrong…
i guess mistake is in updating new index in hashmap after swapping ??? can u tell where