NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: Alfonso V on September 21, 2004, 09:35:39 AM

Title: sorting queues
Post by: Alfonso V on September 21, 2004, 09:35:39 AM
Hi

Somewhere I have readed it is not necessary define heads for single queues, but I'm not agree with this because I think it is necessary for sorting them. Is there any one who think different?. If we want sort a queue (lists in general) we need an entry point, so a head.

Thak you
Title: Re: sorting queues
Post by: Alfonso V on September 21, 2004, 12:57:55 PM
Explain myself:

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?