Re: Algorithm wanted
From: Kurt Van Samang (dreamchaser1981_at_NOSPAM.hotmail.com)
Date: 03/07/04
- Next message: Gerry Quinn: "Re: Algorithm wanted"
- Previous message: Gianni Mariani: "Re: Algorithm wanted"
- In reply to: Kurt Van Samang: "Algorithm wanted"
- Next in thread: Gianni Mariani: "Re: Algorithm wanted"
- Reply: Gianni Mariani: "Re: Algorithm wanted"
- Reply: CBFalconer: "Re: Algorithm wanted"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 07 Mar 2004 20:03:46 GMT
Hi,
I want to thank everyone who answered. I'm sorry that I wasn't quite clear
about whether I wanted the longest row or not. What I actually want is to
detect some "intruders" that incorrectly where inserted into the row. I'm
working on a computer graphics project in which I take evenly-spaced samples
from a polyline and transfer them to a polyline in the same neighbourhood in
the next frame. But sometimes some of them arrive at a wrong position. Since
they all get an id at start I wanted to detect those that arrived on a
incorrect position. So it doesn't really have to be the longest row.
Let's change the example 10-5-6-21-35-42 to 18-5-6-21-25-29, then I would
prefer 18-21-25-29 cause it seems like 5 and 6 don't belong there. Anyway,
it doesn't have to be 100% correct, so I could live with a result of
5-6-21-25-29, as long as they are in order. Of course in the example
5-1-2-3-4 I'm not quite happy with just 5, cause it's quite obvious that 5
doesn't belong there. So I guess I'm gonna try the longest ascending
subsequence algorithm.
thx to you all
"Kurt Van Samang" <dreamchaser1981@NOSPAM.hotmail.com> schreef in bericht
news:cWs2c.25570$3I3.1359921@phobos.telenet-ops.be...
> Hi,
>
> I need an algorithm that will do more or less this. Let's say we have an
> array with some numbers, size is variable. Now I would like to throw away
> all values that aren't in order. Some examples:
>
> 5-1-2-3-4 will generate 1-2-3-4
> 5-1-6-7-8 will give 5-6-7-8
> 10-5-6-21-35-42 will give 10-21-35-42 or 5-6-21-35-42, doesn't matter that
> much, as long as the remaining items are in order
>
> What's a fast way to do this?
>
> thank you
>
>
- Next message: Gerry Quinn: "Re: Algorithm wanted"
- Previous message: Gianni Mariani: "Re: Algorithm wanted"
- In reply to: Kurt Van Samang: "Algorithm wanted"
- Next in thread: Gianni Mariani: "Re: Algorithm wanted"
- Reply: Gianni Mariani: "Re: Algorithm wanted"
- Reply: CBFalconer: "Re: Algorithm wanted"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]