Problems on search/ sort --------------------------- Q. Design an algorithm to find the duplicates in an array. Given an array of random integers, write an algorithm in C that removes duplicated numbers and return the unique numbers in the original array. E.g Input: {4, 8, 4, 1, 1, 2, 9} Output: {4, 8, 1, 2, 9, ?, ?} void rmdup(int *array, int length){ int *current , *end = array + length - 1; for ( current = array + 1; array < end; array++, current = array + 1 ){ while ( current < end ){ if ( *current == *array ){ *current = *end--; } else{ current++; } }// while ends ... } // for ends ... } // func ends ===================== Q. Given an array of length N containing integers between 1 to Nm determine if it contains any duplicates. How can we efficiently find out if any of those numbers are duplicates ? To know only The easiest approach is to make a hash table to keep track of the numbers we've seen so far. Somet
technical topics of interest and mostly centric to telecom domain ..