flat assembler
Message board for the users of flat assembler.
Index
> Main > sorting queues |
Author |
|
Madis731 21 Sep 2004, 10:46
It depends - you don't HAVE TO but it's easier to have them
Like in school you are given an assignment to reverse a string witout asking its length or even making new variables It would be a lot easier to reverse a string if you know its length beforehand but its ingenious to solve without it We wouldn't be assembly programmers if we didn't like these algorithm solution findings |
|||
21 Sep 2004, 10:46 |
|
avcaballero 21 Sep 2004, 12:49
Hi Madis731
Suppose we have next structures myStructure: position data pointer 104 ? 108 108 5 10C 10C 1 110 110 4 114 114 3 0 yourStructure: position data pointer 104 5 108 108 1 10C 10C 4 110 110 3 0 I Can sort myStructure: position data pointer 104 ? 10C 108 5 0 10C 1 114 110 4 108 114 3 110 And I can print it (10C) 1 (114) 3 (110) 4 (108) 5 (0 *end*) We can sort also your structure: position data pointer 104 5 0 108 1 110 10C 4 104 110 3 10C But, how can you write it without a pointer (head) to 108 position? |
|||
21 Sep 2004, 12:49 |
|
Madis731 25 Sep 2004, 07:11
Ok, that is another subject
Here you have a linked list and then you must have something to end it, and this list doesn't even have to be in one memory area. What I was thinking is sorting them in place so this array 5,1,4,3 can be arranged to 1,3,4,5 or 5,4,3,1 and the first one is always assumed to be the 1st by the program. But...if you really wanna get tricky you could have two pointers in each structure: next position(bigger) and the last position (smaller). So whenever you trip on one structure, you can find them all, but then you MUST have a head and a tail. |
|||
25 Sep 2004, 07:11 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.