[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Post your most compact Linked List implementation. >inb4
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 28
Thread images: 2
File: 1440864377337.gif (61 KB, 600x450) Image search: [Google]
1440864377337.gif
61 KB, 600x450
Post your most compact Linked List implementation.

>inb4 /g/ doesn't even know how to code a linked list
>>
>g-guys do my homework for me
lol
>>
>>53324420
it's not my but it should be enough to have an idea of it: http://www.boost.org/doc/libs/1_60_0/doc/html/intrusive/list.html

why do you need a linked list (assuming it's not your homework)? Take a vector or something similar and maybe a few more iterators.
>>
>>53324494
>>53324523
It's just a test to see whether /g/ knows how to implement anything else than hello world
>>
>>53324533
>implement anything else than hello world
I can implement you a hello world program with a boost::list
>>
>>53324523
>>53324546
>using boost
Get a load of this script kiddie
>>
>>53324420
Im in physics and even we had to learn that in the intro to prog course
>>
>>53324563
>using arguments.
>>
>>53324420
lmao i'm not some nerd loser
>>
>Haskell
data LL x = Value x [LL x] | End 
>>
>>53324617
Whoops, that's a tree.
data LL x = Value x (LL x) | End 
>>
from top of my head:
struct
{
int someValue;
Banana* next;
} typedef Banana;

Banana* GetNextBanana(Banana* prevBanana)
{
return prevBanana->next;
}

void main()
{
int n = 100;
Banana** bananas = malloc(SizeOf(Banana) * n);
. . .
}


Haven't done C since I left the embedded industry. 3 years of C# made me rust, so don't trust it.
>>
>>53324420
>Rust
struct LinkedNode<T> {
data: T,
next: Option<Box<LinkedNode<T>>>
}
impl LinkedNode<T> {...}
struct LinkedList<T> {
first: Option<Box<LinkedNode<T>>>
}
impl LinkedList<T> {...}
impl Iterator for LinkedList<T> {...}
>>
>>53324635
>embedded industry
>3 years of C#
What sort of work did you do then and now?
>>
>>53324420
#include <sys/queue.h>
>>
>>53324635
>linked list
>declares a size
>>
>>53324669
>not being able to read
>>
>>53324679
Hahaha I noticed when I posted. My brain isn't working after a long night awake and only 3 hours of sleep. I'll just shitpost from now.

>>53324668
Gambling machine software, IoT dimmers and home automation shit. Now desktop software in WPF and multiplatform applications with Xamarin.
>>
>>53324701
>Gambling machine software, IoT dimmers and home automation shit. Now desktop software in WPF and multiplatform applications with Xamarin.
Why would anyone trade the first job for the 2nd? Embedded dev sounds way more fun
>>
type 'a linked_list = 
| None
| Node of 'a * 'a linked_list;;
>>
>>53324736
No crazy deadlines, no messy legacy code, no manager that would literally hire 9 girls to bear a baby in 1 month because he thinks that's how things work... much easier job atm. for way more cash. But sometimes I do miss the IoT shit.
>>
class LinkedList
attr_accessor :next, :value
end
>>
File: windows7_insert.png (12 KB, 525x300) Image search: [Google]
windows7_insert.png
12 KB, 525x300
Linked lists suck
>>
>>53324635
This guy nailed it.
But I'd just copy one from ccan or the kernel. Why independently solve a menial problem which has already been solved by people much smarter than me and tested by others just like me? That's the whole point of open source.
https://ccodearchive.net/info/list.html
>>
>>53324736
>>53324793
I also think embedded dev sounds fun, but literally everyone who has done it says it sucks. I guess you have to have done it to get over it.
>>
>>53324420
typedef struct a a;

struct a {
a * next;
int value;
}
>>
#include <list>

list <filetype> name;


That was hard
>>
>>53325468
Beat me to it

In other news
Why would anyone want to check if /g/ could implement a linked list, its a tiny step above the most trivial things in introductory CS classes, so you are simply asking "is /g/ a programmer or not"
>news

Do your own homework kid its better for yourself, or at least be straight about it when asking for help
Thread replies: 28
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.