Slice sequence--new algorithm
- Posted by Lutz_Heitmann at NF.MAUS.DE Feb 20, 2001
- 426 views
Kommentar zu P48305@KI in der Gruppe EUPHORIA Hello Al, AG>That's a nice little algorithm too! No big deal - simple and straight forward... ;) AG>My little example algorithm was more memory efficient Yes, but nowadays time is more valuable than memory space! AG>This is mainly due to the fact that your algorithm creates AG>a second copy of the original sequence, meaning at the end AG>of the code there exists two copies of the same sequence AG>given no removals What do you think EUPHORIA does internally? To create a sequence with only the last element different, all the pointers to sequence elements up to this point have to be copied anyway! A points to B, B points to C, C points to - something other than D. So the sequence from A to C needs to be rebuilt. Think of LISP's CARs and CDRs! (do you know LISP?) AG>If your target system can handle this, i would certainly AG>use it. Go ahead! My "target system" is plain DOS, but from what I know I can guess a lot about data structures. Lutz.