FW: permutation (Oops!)

new topic     » topic index » view thread      » older message » newer message

Corrected function
> ----------------------
> global function RemoveDuplicate(sequence s)
> sequence so
> if not length(s) then return s end if
> so = {s[1]}  --<----------------------- Here's the correction: { } added.
> for i = 2 to length(s) do
> 	if find(s[i], so) then
> 	else so = append(so, s[i])
> 	end if
> end for
> return so
> end function
> ------------------------
> 
> Henri Goffin
> 
> -----Original Message-----
> From:	tone.skoda at siol.net [SMTP:tone.skoda at siol.net]
> Sent:	30 May, 2002 14:00
> To:	EUforum
> Subject:	permutation
> 
> For example, if I use Permutation ({3,1,1,1,0,0}, 6, i) I will get a lot of
> results which will be equal to each other.
>  
> I know I can save all results in a sequence and use find () (or binary search)
> to find out if such sequence was already returned from Permutation(), but is
> there any faster way?
> 
>

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu