Answered Questions

  • Duplicate Elements Array

    You have an array of size '2n' of these, 'n+1' elements are distinct and 1 element is repeated 'n' times. You must find the repeated element and say how many times it has repeated. Your solution must use minimum no. of comparisons. Also, say how many comparisons your solution will make in the worst case?

    shankar

    • Oct 16th, 2012

    Since an element is repeated more than half the occurance of the array, for every two didtinct elements discard them from the array. At the end of the loop, the most repeated element will be left.

    This is O(n)

  • What is the difference in Searching and Sorting ?

    loki

    • Feb 27th, 2018

    Searching means finding whether the element is present in the list or not whereas sorting means Arranging the list in ascending or descending order.

    Jeff

    • Jun 4th, 2017

    Searching mean when you are performing an operation looking for a specific thing that you need...the thing that you are looking for does not alike to any thing so you have to find your exact requireme...