Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
comparing large amounts of data
could anybody help me with the following task:
i have an array of data: adata[n].
now (at least) k elements of this array are equal, but i don't know which. comparing two elements is very time expensive, so i want to do this task with comparing as little elements as possible.
how could i get the indices of the equal elements?
k is greater than n/2, so that there can only be one solution.
also k elements of the elements should be equal, but this is not sure.
it should also be possible to determine fast if there are (at least) k equal elements in the array.
Thanks for your help.