
Asked in Cisco
Design an algorithm that, given a list of n elements in an array, finds all the elements that appear more than n/3 times in the list. The algorithm should run in linear time ( n >=0 ). You are expected to use comparisons and achieve linear time. No hashing/excessive space/ and don't use standard linear time deterministic selection algorithm.

AnswerBot
2y
Algorithm to find elements appearing more than n/3 times in an array in linear time
Divide the array into three equal parts
Iterate through the array and count the occurrences of each element in each pa...read more
Help your peers!
Add answer anonymously...
Top Electronic Packaging Designer Interview Questions Asked at Cisco
Q. #define clrscr() 100 main() { clrscr(); printf(?%d?,clrscr()); }
Q. Main() { int ret; ret=fork(); ret=fork(); ret=fork(); ret=fork(); if(!ret) print...read more
Q. Given an array which is alternatively sorted, find an element in it. For example...read more
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

