Forum Moderators: coopster

Message Too Old, No Replies

Finding duplicate in an array

most efficient algorithm?

         

kkonline

2:51 pm on Oct 24, 2007 (gmt 0)

10+ Year Member



I have an array of positive integers.
The length of array is known "n".
The maximum and the minimum values in the arrays are known (thay are unique for simplicity)

The aim: to display/remove the duplicate entries in array

I cannot make out what to do with the minimum and maximum values to make the algorithm efficient

Any suggestions?

d40sithui

3:30 pm on Oct 24, 2007 (gmt 0)

10+ Year Member



try array_unique()

Sagaris

3:41 pm on Oct 24, 2007 (gmt 0)

10+ Year Member



If you just want to remove the dupe values from the array can you not use the array_unique() function?

[uk2.php.net ]