Difference between revisions of "Talk:2483: Linked List Interview Problem"

Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search
m
(Modern Perspective)
Line 18: Line 18:
 
I second a previous comment, the code *does not* send the list to the museum, only the string representation of the head pointer. So the examiner may be rightully pissed off because both can be true: the candidate is trying to make fun of list algorithms '''and''' he doesn't know how to deal with a list.  
 
I second a previous comment, the code *does not* send the list to the museum, only the string representation of the head pointer. So the examiner may be rightully pissed off because both can be true: the candidate is trying to make fun of list algorithms '''and''' he doesn't know how to deal with a list.  
 
(Unsure of what follows: given that the code looks like python, this may also be sarcasm about the style of (not only) python programming that always resorts to some external code module instead of defining new data structures and coding related methods. In this case, the external module is a museum :-) ). [[User:Xkcdmax|Xkcdmax]] ([[User talk:Xkcdmax|talk]])
 
(Unsure of what follows: given that the code looks like python, this may also be sarcasm about the style of (not only) python programming that always resorts to some external code module instead of defining new data structures and coding related methods. In this case, the external module is a museum :-) ). [[User:Xkcdmax|Xkcdmax]] ([[User talk:Xkcdmax|talk]])
 +
 +
Those wondering why linked lists are considered obsolete: insertion and deletion performance is rarely the issue these days. It's the cost of enumerating over all elements in the list. Both arrays and linked lists have O(n) complexity there, but arrays have the lower cost. And that's before we get into stuff like caches liking predictable access patterns (pointer chasing is not predictable) and all those pointers costing precious cache memory space.--[[User:Henke37|Henke37]] ([[User talk:Henke37|talk]]) 09:45, 1 July 2021 (UTC)

Revision as of 09:45, 1 July 2021

Assuming not everyone understands O notation: O(1) means that it always takes the same time, no matter how much data is stored. O(n) means the time is proportional to the amount of data stored - if you have 10 times the data, it takes 10 times as long to find the one you want. 108.162.221.84 (talk) (please sign your comments with ~~~~)

This code won't mail the linked list to a museum - it will mail the memory location of the head of the list to a museum. 172.70.130.192 (talk) (please sign your comments with ~~~~)

just to make sure I get this right. If I want to save the numbers "1", "2", "3", "4" in an array it could (depending on the programming language) just be "[1,2,3,4]", while a linked list could be "1 (jump to 3rd entry), 4, 2 (jump to 4th entry), 3 (jump to 2nd entry)"? Then entering 2.5 between 2 and 3 would be complicated in the array as you have to move the 3 and 4 to new places, while in the linked list you just change the direction after to to jump to 5th entry, and add 2.5 and the instruction to jump to 4th entry? While it is of course harder to find a specific entry in the linked list. --Lupo (talk) 06:01, 1 July 2021 (UTC)

Does anyone know when the last comic was that used colors? Is this something worth mentioning? --162.158.88.42 06:11, 1 July 2021 (UTC)

I found the category:. --162.158.93.153 06:17, 1 July 2021 (UTC)

I added some words regarding the title text. Feel free to expand/clarify/correct as necessary. 172.69.35.209 06:57, 1 July 2021 (UTC)

The comic could also be a reference to the British Museum Algorithm. --162.158.88.110 09:09, 1 July 2021 (UTC)

I second a previous comment, the code *does not* send the list to the museum, only the string representation of the head pointer. So the examiner may be rightully pissed off because both can be true: the candidate is trying to make fun of list algorithms and he doesn't know how to deal with a list. (Unsure of what follows: given that the code looks like python, this may also be sarcasm about the style of (not only) python programming that always resorts to some external code module instead of defining new data structures and coding related methods. In this case, the external module is a museum :-) ). Xkcdmax (talk)

Those wondering why linked lists are considered obsolete: insertion and deletion performance is rarely the issue these days. It's the cost of enumerating over all elements in the list. Both arrays and linked lists have O(n) complexity there, but arrays have the lower cost. And that's before we get into stuff like caches liking predictable access patterns (pointer chasing is not predictable) and all those pointers costing precious cache memory space.--Henke37 (talk) 09:45, 1 July 2021 (UTC)