Anonymous user
Sort a list of object identifiers: Difference between revisions
→Using Piece$() and Stack Sort
No edit summary |
|||
Line 617:
</pre>
===Using Piece$() and Stack Sort===
We use a stack (a linked list) to save numbers, and a function to check piece by piece for "
piece$(a$,".")(i) works from 0
Line 627:
<lang M2000 Interpreter>
def i
do {
Line 652:
\\ if peek item i > peek item i+1 then get i+1 to top, and send to i
\\ stack is a linked list, so moving items done with pointers only
if
}
} Until Not addone
Line 664:
Using a function which split pieces one time. We have to insert one more item, by append a "." to a$ and b$
<lang M2000 Interpreter>
def i=-1
dim Base 0, a$(), b$()
|