Is the.NET LinkedList a circular linked list? (1 Viewer)

bettey12

New member
Local time
Today, 08:38
Joined
Jun 20, 2022
Messages
8
I'm looking for a circular linked list and was wondering whether LinkedList is one.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 22:08
Joined
Feb 28, 2001
Messages
27,319
I went online and the structure they described was not circular. Which means it is an open DEQ (double-ended queue). Which in turn probably means that BACK from the first entry is null/nil and NEXT from the last entry is also null/nil.
 

Isaac

Lifelong Learner
Local time
Yesterday, 20:08
Joined
Mar 14, 2017
Messages
8,871
Yeah because https://www.c-sharpcorner.com/article/linked-list-implementation-in-c-sharp/
describes the 3 types - and circular linked is differentiated from doubly linked, which according to popular wisdom, doubly linked is the .net thing

This reminds me of a particularly troublesome dog we were dog sitting last year. He was so big and wild, not what we were told when they dropped him off. I eventually chained him to a tree and it was the only thing that could contain the beast. And even that, he sat there for 10 minutes "chewing" the chain. Not the sharpest tool in the shed, no pun intended.

Why people want to own dogs like this I'll never understand. My dog is a teddy bear, but if I bought one as a weapon, I would at least make sure it was highly obedient. You talk about guns, but millions of people own untrained wild savage weapons flying around with way too little restraint, and accidents happen constantly because of it. Yet we never talk about barring stupid people from buying untrained savage beasts.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 22:08
Joined
Feb 28, 2001
Messages
27,319
The way people drive in south Louisiana, it ain't DOGS that are the most dangerous weapons. BUT, we digress.

A true circularly linked list simply starts with a formal LISTHEAD - a list item that is a place-holder - that points to itself in both directions. In programs that use this, there is also an external pointer that points to the listhead item. Often the listhead contains a special mark that says "I'm a listhead" so that when you step through the list, you know what you have come full circle. With that circular structure, it becomes a "full random insertion and removal" queue since you can insert or remove non-listhead items anywhere in the queue by threading through until you find the place you want it to go, even the "first" or "last" element.

To convert a circular DEQ from of a non-circular DEQ, create a listhead entry and insert it at both ends. Then remember when traversing the queue that traversal is infinite if you don't honor the listhead's "I'm a listhead" marker. This is one reason why folks often DON'T use circular queues.
 

jdraw

Super Moderator
Staff member
Local time
Yesterday, 23:08
Joined
Jan 23, 2006
Messages
15,394
Some info on circular/doubly circular linked lists.
CircularLinkedList.png
DoublyCircularLinkedList.png

For more: see this link
 
Last edited:

Isaac

Lifelong Learner
Local time
Yesterday, 20:08
Joined
Mar 14, 2017
Messages
8,871
The way people drive in south Louisiana, it ain't DOGS that are the most dangerous weapons
I stand corrected and couldn't POSSIBLY agree with you more. Unchecked too-fast and careless driving with zero rule-following (like turn signals), I've been saying for years, has got to be near the top of the worst cause, the most obvious thing causing 10's of 1000's of totally preventable deaths. By simply enforcing strict adherence to the "smaller" traffic rules (speed, turns) we could easily save many lives. The thing that most gets me is traffic slowing to gingerly tip-toe past a horrific accident, with mothers and dads and children laying on stretchers on the 150-degree pavement, and then as soon as they're past it, the idiot drivers speed right back up and start acting crazy.......the experience had no effect on them.
For me when I pass such a thing it at least makes me think soberly about my driving attention for the rest of the way home!

true circularly linked list simply starts with a formal LISTHEAD - a list item that is a place-holder - that points to itself in both directions. In programs that use this, there is also an external pointer that points to the listhead item. Often the listhead contains a special mark that says "I'm a listhead" so that when you step through the list, you know what you have come full circle. With that circular structure, it becomes a "full random insertion and removal" queue since you can insert or remove non-listhead items anywhere in the queue by threading through until you find the place you want it to go, even the "first" or "last" element.

This sounds suspiciously like many arguments I have with my wife. By the time she is done I am reminded of the Billy Joel song, "
Oh, and she never gives out and she never gives in
She just changes her mind"

Is it just me?
 

Users who are viewing this thread

Top Bottom