retagged by
475 views

1 Answer

1 votes
1 votes

Assuming an array to be unsorted ,

we can maintain a count of occurence of each element in an other array , say count[] .We read an element from input array and increment that index of count[] which is the value in the input array.

So we get count of each element in 1 iteration over the input array.

Next by getting the maximum count from count array ,we can report the corresponding index of count array which is actually the element which is occuring most frequently.

Hence the correct answer should be B)

Related questions

8 votes
8 votes
2 answers
1
2 votes
2 votes
1 answer
4
yes asked Oct 6, 2015
1,329 views
for example array contain a[1 2 3 3 3 3 3 4 5] then retun(1)