Interview Question for Analysts
- 0of 0 votes
Given an unsorted array (of unknown length .. can be infinite even ).. at any point of time , how to find a number which is repeated for maximum times , followed questions is how to find a number which is repeated for n times.- gopi.komanduri June 12, 2013 in India
Answer I proposed is using combination of binary st as ell as heap.
ex: this binary search tree will have structure which even has pointer to its correponding healelement's pointer.
while inserting an element into tree , will check whether it is repeated , if yes , will increase the priority of this element , and adjust heap accordingly.
Please comment on this solution
| Report Duplicate | Flag | PURGE
Interview Type: In-Person
Open Chat in New Window