0

Hi
i have a programming problem ;)
I have a set of number(there is no limit must be dynamic) and i want to find out the unique numbers from the set i.e numbers which are not repeated.

Observation:
1) No. of element in set should not be limited
2) Algorithm should be As simple as possible

I am trying to find an algo please help me if any one can....

from
khan

4
Contributors
5
Replies
6
Views
11 Years
Discussion Span
Last Post by Lerner
0

Well this question is not Homework etc..
and i am not clear with the answer you have posted...
can u clarify a bit


from
khan

0

What language are you using?
What, if any, limitations are imposed on you (like not using standard functions on homework)?
Have you looked into the standard functions that already do this?

0

1.read elements into an array
2.i=0
3.j=i+1
3.while(1)
4.while(j!=max)
5.if(a=a[j])
6.i++;
7.j=i+1;
end if
8.repeat
9.if(a!=a[j])
break
10.repeat
11.uniq number=a
12.stop

0

Is this something you want to do on your own as a learning assignment or would you be willing to use standard solutions such as the STL set class which guarantees uniqueness of elements entered into the container, has a method that allows you to deteremine how many elements are in the set at a given point, and manages memory dynamically for you so the size of the container is limited only by the RAM available?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.