You are here:

C/C programming

Advertisement


Question
Please help me in writing a C Code for Deletion of Duplicates from a Sorted array.
thanks

Answer
Hello Kuldeep

The easiest way to do this is to first print the unique elements to the screen. Once that is working you can put the unique elements into a new unique array instead of printing them to the screen.

You need to go through each element of the sorted array and compare each element with the previous element. Of course when you are examining the first element there will be no previous element so that is a special case. You need to print out the current element if it is the first element or if it is not the same as the previous element.

Show me an attempt at that and I will help you more if you need it.

Best regards
Zlatko

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Zlatko

Expertise

No longer taking questions.

Experience

No longer taking questions.

Education/Credentials
No longer taking questions.

©2012 About.com, a part of The New York Times Company. All rights reserved.