[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1751624676438591.png (173 KB, 1007x1004)
173 KB
173 KB PNG
>need a doubly linked list
>never implemented or used such before
>google for tutorial
>receive this insanity
Isn'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.
>>
>>106566044
picrel 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
>>
>>106566066
Yeah 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 end
You 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 head
would 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
>>
>>106566072
In what kind of circumstances would I have a doubly linked list without knowing its head and tail pointers? I don't get it.
>>106566084
It triggers me that the internet is so full of shit nowadays.
>>
>>106566044
>I bet this is either AI generated or indian slop
I 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.
>>
>>106566125
The 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
>>
>>106566156
Forgot 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.
>>
>>106566158
But 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
>bot
Am I having a brain aneurysm or what the fuck is this shit? I meant "code" and "about".
>>
>>106566044
>implementing basic data structures yourself
only idiots do this
>>
>>106566044
yeah 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
>jeetsforjeets
The fuck did you expect?
>>
>>106566044
Looks like doubly linked with no tail for some reason. The whole diagram is a bit wonky.
>>
>>106566196
then 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
>>
>>106566584
Does c even have a linked list building function? They're not really complicated enough to need one.
>>
>>106566929
Oh 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.
>>
>>106566044
Always 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.
>>
>>106566070
For 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.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.