Which algo?

Started by
2 comments, last by Shaun Patterson 22 years, 3 months ago
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
Advertisement
Hash it.

Later,
ZE.

email me.zealouselixir software. msdn. n00biez.
miscellaneoulinks

[twitter]warrenm[/twitter]

Yeah.. I was afraid it would come to that.

Thanks
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).

This topic is closed to new replies.

Advertisement