Hi Friends..im new to this site and i need help.

I need source code for removing duplicate values from an array of integers.
please help me as soon as you can..Thanks a lot!!

Recommended Answers

All 9 Replies

do your own homework.
This is so basic you should be able to do it with a few hours of instruction.

Here's the code:

Oh wait, I don't take orders from you.

See, if you would have at least showed a little effort and proved you at least know something about what you're doing, then I would help. But I don't take orders from you.

Member Avatar for iamthwee

It's simple, I'll give you a hint.

e.g

1,6,3,7,7,2,4,20,1

First, sort your array into ascending order.

1,1,2,3,4,6,7,7,20

Then have a nested for loop and loop through the sorted array.
If the next element is the same as the first delete it. Keep doing the same until you encounter a different number. Repeat until finished. :lol:

hell, no. That's far too complicated...
You can skip the sorting, and do a rather simple check on duplicates on filling the return array.

Member Avatar for iamthwee

>You can skip the sorting, and do a rather simple check on duplicates on filling the return array.

Please shoe me. I can't see it. :sad:

Member Avatar for iamthwee

Actually, I see it now ...and my way does not preserve the original order which could be a problem.

This link, written for c++ shows a way how to remove duplicates without having to sort the list first, however, it seems more difficult to me. :cry:

hmmm,

http://uk.builder.com/programming/c/0,39029981,20271583,00.htm

hey Server Crash..i wasn't giving any orders to anyone..i just asked for help..i am new to Java and i don't know much about C++ as well...so just thought i would find some kind people here to help me..
anyways thanx a lot for the answer..

Thanx a lot friends (Who atleast Thought it would be worth helping me) i'll try the program on my own now..coz i wasn't getting a road to start with..now i think i can write the program myself and will post it here as soon as i can..
Thanks a lot for showing copncern and finding out time for me!!!

Member Avatar for iamthwee

Thanx a lot friends (Who atleast Thought it would be worth helping me) i'll try the program on my own now..coz i wasn't getting a road to start with..now i think i can write the program myself and will post it here as soon as i can..
Thanks a lot for showing copncern and finding out time for me!!!

It is ok I am learning too. :cool:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.