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

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

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?

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

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?

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.