"Keren Yehezkel" <ke*****@clalcredit.co.il> wrote in message
I would like to know what is the most efficient way
To create a set (group with no duplicate members)
From a user input (only integers), while reserving the order that
the input was received in.
This all depends what you mean by efficiency. There is runtime efficiency,
memory efficiency and, as a rule the most important of all, programming
efficiency.
If you have an upper bound on the size of your set then just creating an
array, walking through it to look for duplicates, and appending an
non-duplicate is probably the best way to go.
This isn't the most efficient way of doing things if the input is very
large, but on a decent machine you probably won't have to worry about this.