Which algo?
I''m currently working on a program that needs to run through a large list of strings and and copy them to another array (excluding the duplicates).. Like so:
(First array)
"Test1", "Test1", "Test2", "Test3", "Test3"
would be
"Test1", "Test2", "Test3",
I''m basically doing it this way:
Read first time
loop to end of array
is it the same as previous item?
just continue
different?
copy to second array
This works fine except i''m working on a Palm handheld. So.... when I have an array of say... 300 numbers it gets a little slow.
Does anyone know a better algorithm - even if it''s just the name, I''ll look it up
Thanks!
~Shaun Patterson
or...
get your array, quicksort it, then do an adjacent search only.
If you''re using STL, it''s three lines of code (after you have your array).
get your array, quicksort it, then do an adjacent search only.
If you''re using STL, it''s three lines of code (after you have your array).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement