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

YOU THERE! SHOW ME HOW YOU DELETE AN ENTRY FROM A LINKED LIST

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 17
Thread images: 5

YOU THERE! SHOW ME HOW YOU DELETE AN ENTRY FROM A LINKED LIST OR ELSE I'LL SHOOT YOU WAIFU!
>>
>>57642097

Not doing your homework nigger. You even stole that image didn't you?
>>
>>57642097
go back to school nigger
>>
current->previous->next = current->next
current->next->previous = current->previous
whatever unlinks current in your language
>>
>>57642097
doggu_list = [[1, 2, 3][3, 2, 1]]

doggu_list[0].pop(0)
doggu_list[1].pop(1)



that's in python.
>>
File: 1454608638723.gif (1021KB, 500x484px) Image search: [Google]
1454608638723.gif
1021KB, 500x484px
kinda drunk and on my phone but anything for misato-san

NodePtr pred;
NodePtr cur;

pred = new NodeType;
cur = head;
while(cur != NULL && cur->data != key)
{
pred = cur;
cur = cur->next;
}

if(cur != NULL)
{
pred->next = cur->next;
delete cur;
}
>>
>>57642097
(remove item list)
>>
File: le absolutely disgusted asuka.jpg (33KB, 492x479px) Image search: [Google]
le absolutely disgusted asuka.jpg
33KB, 492x479px
>>57642500
>used goods
>>
File: tumblr_my2mijmVhL1rb06tgo1_500.gif (906KB, 500x281px) Image search: [Google]
tumblr_my2mijmVhL1rb06tgo1_500.gif
906KB, 500x281px
good luck with that
>>
list.next();
list.remove();
>>
>>57642097
joke's on you i'm not an animufag
>>
Do it like Linus tells you to do. Unless you have bad taste.
>>
>>57643015
I want to marry Nui.
>>
File: top jej.jpg (246KB, 800x600px) Image search: [Google]
top jej.jpg
246KB, 800x600px
>>57642097
>implying

She will kick your ass
>>
Alright nigger.

First you reach your to-be-deleted node with your lookup node logic, call it currentNode.

Assign the currentNode's previous node's next field to the currentNode's next field. Assign the currentNode's next node's previous field to the currentNode's previous field.

That's it really. If you have to manage memory you can free your node now.
>>
i don't rmeember lol
>>
>>57642097
easy
struct Node {
next: Option<Box<Node>>
}

impl Node {
fn remove_next(&mut self) {
let mut next: Option<Box<Node>> = None;
swap(&mut next, &mut self.next);
if let Some(mut next) = next {
swap(&mut self.next, &mut next.next);
}
}
}
Thread posts: 17
Thread images: 5


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.