>need a doubly linked list>never implemented or used such before>google for tutorial>receive this insanityIsn't this like totally wrong and retarded? What the fuck is this? If you keep track of head and tail of the list then you surely won't have to traverse the list to insert at the end, right? This is why the internet sucks nowadays, I bet this is either AI generated or indian slop.
>>106566044picrel only keeps track of the head tho, in that case they are right that you need to traverse the whole list even if it's kinda dumb
>>106566066Yeah I mean why would anyone ever keep track only of the head?
>>106566044>then you surely won't have to traverse the list to insert at the endYou would because the data structure grows, isn't contiguous, and you have no knowledge of its length at the beginning
>>106566070>why would anyone ever keep track only of the headwould be good enough for a stack, but then you wouldn't need a a double linked list. idk anon they make up random shit for SEO
>>106566072In what kind of circumstances would I have a doubly linked list without knowing its head and tail pointers? I don't get it.>>106566084It triggers me that the internet is so full of shit nowadays.
>>106566044>I bet this is either AI generated or indian slopI stopped using GeeksForGeeks many many years ago when I started noticing how jeeted everything was and that one really stood out.If I had to play devil's advocate though, it seems like they're going for a very purist explanation. I'm not sure what else to call it. They're explaining a doubly linked list as minimally as possible, so they're not giving you a practical, ready-to-use implementation with a metadata struct that holds a reference to the tail and a delete function that correctly updates that tail, and so on.
>>106566125The purpose of a doubly linked list instead of single is for traversing forwards and backwards so anything you would have an unknown number of elements at compile time, and you want to be able to traverse forwards and backwards, the first google example was a browsers history, you don't know how much the user is going to store AoT, you'd want to traverse it forwards and backwards
>>106566156Forgot to mention, it's still really dumb because doing it that way they deleted a huge benefit of the structure, but I can't say I haven't been guilty of adhering to a certain set of general rules and guidelines to the point of using it as a crutch to escape having to think and end up doing something stupid like this.
>>106566158But I can keep track of the head and tail at all times, when inserting or deleting my could would update head or tail if needed. This way my could would always know bot the head and the tail pointers.
>>106566196>could>botAm I having a brain aneurysm or what the fuck is this shit? I meant "code" and "about".
>>106566044>implementing basic data structures yourselfonly idiots do this
>>106566044yeah there was tons and tons of indian internet slop for decades. now all the AIs are being fed the indian slop to regurgitate even worse, all so some indians can "learn" from that slop and restart the process. fucking ouroborous of garbage.god help you for webdev shit is even worse.
>>106566044>jeetsforjeetsThe fuck did you expect?
>>106566044Looks like doubly linked with no tail for some reason. The whole diagram is a bit wonky.
>>106566196then you don't need to USE a doubly linked list, the resource is merely teaching you about their existence, memory wasn't as free back when the concept was invented
>>106566584Does c even have a linked list building function? They're not really complicated enough to need one.
>>106566929Oh I do need to use it because I need to be able to effortlessly loop over the list while inserting/deleting in any position of the list.
>>106566044Always add “before:2020” to get rid of AI results when searching with google. I’ve found that using “before:2014” gets rid of 90% of the hindu slop too, not sure why.
>>106566070For hash tables to reduce size of bucket array. But you wouldn't walk the list, you would just insert a new node at the head, as order doesn't matter. Two links are needed for O(1) removal.See "struct hlist_head" in Linux kernel.