I got shortlisted for interview at IIT Hyderabad CSE via self sponsored mode. It was held on 13 June 2022. I had only revised DS-Algo and Maths. The interview consisted of 2 interviewers.
Person 1: Pls introduce yourself in 30 sec. Like your name, college name, favourite subjects, thesis name,project name etc
Me: (I told them abt myself)
Person 1: What was your thesis on? Can u explain it?
(I was completly unaware what thesis meant as in our college, we only did major project, so i told him that we only had major project and explained him that)
Person 1: Did you deploy your project?
Me: Yes I did
Person 1: As you told your favourite subject is algorithm, can u please tell me the time complexity to find 2 numbers in an unsorted array in such a way that those 2 number’s sum is target. Target will be given as input
Me: I first explained the naive method of O(n^2). Then i said that i will sort them and use 2 pointer method to find..tc= O(nlogn +n) ~ O(nlogn).
Person 1: Can you optimize it further? Have you heard of hashmap, can u optimize using that?
Me: I was pretty struck there..I tried doing it but couldnt do that. Later after the interview i realized that i already knew the method but due to the situation, i panicked and couldnt give the ans.
The ans was , take a element from the array, check if target-element is there in hashmap or not.. do this for every element.. searching in hashmap is O(1) .. thus tc = O(n)
Now person 2 started asking me question
person 2: Tell me the worst case complexity of quicksort
Me: I explained him the entire quicksort.
Person2: Suppose you are given median element using a certain algo which takes O(n) tc. will the time complexity be reduced
me: I told them the recurrance relation of quicksort using median as pivot .
And the interview ended. The results are awaited.