"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > Dia - Reimplementing doubly linked circular list

Dia - Reimplementing doubly linked circular list

Published on 2024-11-08
Browse:393

I made some adjustments to the initial version of my list, now it meets the requirements set out in Professor Maziero's material. I adjusted it to pass the tests, and I also decided to use readapt for C. Compilation together with the available test file seemed less problematic that way.

Revisiting the code for this list, I needed to revisit simpler lists that come before the double-linked circular one, so I was able to put together a solid reasoning when coding.

Doubly linked list

Is a structure in which each node contains three parts: Value, pointer to the next node, and pointer to the previous node.

Allows bidirectional navigation, and to remove or add a node, it is only necessary to adjust the points of the previous and next node.

[head]  [nó1]  [nó2]  [tail]

Circular list

It can be simply chained (one-sided sense) or double chained (this is what I'm using for the project).
The last node in the list is connected to the first, which means the list does not have a natural ending point.
The list can be scrolled through indefinitely, because when it reaches the end, it returns to the beginning.

Doubly linked circular list and its relationship to operating systems

Using a circular doubly linked list makes the operating system have a circular scheduling feature.

That said, after the last process is executed, the system returns to the first and continues execution.

Imagining that an operating system has three processes:

[P1]  [P2]  [P3]  [P1] ...

After P3 finishes its execution time, the list will return directly to P1, ensuring continuous execution.

The current operating system code can be found here.

Dia - Reimplementando lista circular duplamente encadeada

Release Statement This article is reproduced at: https://dev.to/matheusgb/dia-20-reimplementando-lista-circular-duplamente-encadeada-4ba8 If there is any infringement, please contact [email protected] to delete it
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3