Skip to main content
gamedev.net
🔒 Locked

Which algo?

Started by Shaun Patterson Jan 7, 2002 at 5:38 PM 2 replies 950+ views
Original Post
Shaun Patterson
Shaun Patterson
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
Stoffel
Stoffel
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).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.