Home > Backend Development > C++ > body text

Dia - Reimplementing doubly linked circular list

Susan Sarandon
Release: 2024-10-20 06:11:30
Original
219 people have browsed it

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-chained circular one, so I was able to put together solid reasoning when coding.

Doubly linked list

It 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]
Copy after login

Circular list

It can be simply chained (one-sided direction) 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 that 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 scaling 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] ...
Copy after login

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

The above is the detailed content of Dia - Reimplementing doubly linked circular list. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!