Topic List |
Page List:
1, 2 |
---|---|
SomeLikeItHoth 12/10/22 6:24:49 AM #1: |
But I have no clue how the fuck I'm supposed to make one @Questionmarktarius @ChocoboMogALT @MedeaLysistrata --- FAM FOREVER. | https://imgur.com/cGrHeeU.jpg ... Copied to Clipboard!
|
MedeaLysistrata 12/10/22 7:10:22 AM #2: |
what language are you using? it seems much simpler in javascript compared to python. but i didn't really know what that was until you mentioned it. --- Please join the 100 Presidents community board and contribute to the project! Check back for updates! https://gamefaqs.gamespot.com/boards/1568-100-presidents ... Copied to Clipboard!
|
SomeLikeItHoth 12/10/22 7:13:15 AM #3: |
JavaScript. Very easy concept to understand. I don't know exactly when you'd use it over an array but I'll watch more videos tomorrow. --- FAM FOREVER. | https://imgur.com/cGrHeeU.jpg ... Copied to Clipboard!
|
ChocoboMogALT 12/10/22 1:24:51 PM #4: |
From what I understand, linked lists are better for memory management but worse for searching compared to arrays. Coming from Java: Start with a class for a node in the list, its data, and the next node it points to. Something like Class node { int data node next } Now make a class for the list itself. The only field it needs is the front node of the list (it's probably null in the constructor), since each node will tell you where the next is. Then you need methods to add a node to the front, end, and middle; remove from front, end, and middle; print the list, its length, and maybe a toString(). You're also going to need constructors for the list and the node. Should be very simple, though might not be obvious. --- "We live in a country Hasire.." ~ yosouf06 REVOLVER STAKE! http://img.photobucket.com/albums/v717/ChocoboMog123/AltEisenRChocoboMog.png ... Copied to Clipboard!
|
Questionmarktarius 12/10/22 5:07:41 PM #5: |
ChocoboMogALT posted... Start with a class for a node in the list, its data, and the next node it points to. Something likeProbably should have a "previous" too, unless that's some other structure. ... Copied to Clipboard!
|
warlock7735 12/10/22 5:10:03 PM #6: |
Questionmarktarius posted... Probably should have a "previous" too, unless that's some other structure.That's a doubly linked list --- CE Mafia Archive https://www.dropbox.com/sh/u3gaka98zsp3m0e/AADYBrilDyGYhlAbpEnac5d_a?dl=0 ... Copied to Clipboard!
|
warlock7735 12/10/22 5:10:51 PM #7: |
Linked list is easier to insert something g into the middle of, worse for accessing values --- CE Mafia Archive https://www.dropbox.com/sh/u3gaka98zsp3m0e/AADYBrilDyGYhlAbpEnac5d_a?dl=0 ... Copied to Clipboard!
|
AlephZero 12/10/22 5:13:34 PM #8: |
figure out how to detect a loop in a linked list and congrats you can now pass many senior software developer interviews --- "life is overrated" - Seiichi Omori 01001100 01010101 01000101 00100000 00110100 00110000 00110010 ... Copied to Clipboard!
|
warlock7735 12/10/22 5:20:30 PM #9: |
AlephZero posted... figure out how to detect a loop in a linked list and congrats you can now pass many senior software developer interviews Iterate, hashmap the pointer to the node (or just the referenced object, as long as it has object equality). Any collision on hashmap insert is a loop. --- CE Mafia Archive https://www.dropbox.com/sh/u3gaka98zsp3m0e/AADYBrilDyGYhlAbpEnac5d_a?dl=0 ... Copied to Clipboard!
|
AlephZero 12/10/22 6:34:37 PM #10: |
warlock7735 posted... Iterate, hashmap the pointer to the node (or just the referenced object, as long as it has object equality). Any collision on hashmap insert is a loop.What's the runtime complexity? Can you do it more efficiently? --- "life is overrated" - Seiichi Omori 01001100 01010101 01000101 00100000 00110100 00110000 00110010 ... Copied to Clipboard!
|
warlock7735 12/10/22 10:29:25 PM #11: |
AlephZero posted... What's the runtime complexity? Can you do it more efficiently? linear runtime, early success in case of collision. Shouldn't be further optimizable, since worst case scenario (no collisions) still requires iteration across each element. --- CE Mafia Archive https://www.dropbox.com/sh/u3gaka98zsp3m0e/AADYBrilDyGYhlAbpEnac5d_a?dl=0 ... Copied to Clipboard!
|
Tyranthraxus 12/10/22 10:32:04 PM #12: |
SomeLikeItHoth posted... But I have no clue how the fuck I'm supposed to make one You don't. Just use the built in one. Or use a reference if whatever you're using doesn't have a built in list. --- It says right here in Matthew 16:4 "Jesus doth not need a giant Mecha." https://i.imgur.com/dQgC4kv.jpg ... Copied to Clipboard!
|
#13 | Post #13 was unavailable or deleted. |
#14 | Post #14 was unavailable or deleted. |
AlephZero 12/10/22 10:45:22 PM #15: |
Tyranthraxus posted... You don't. Just use the built in one.Tbh linked lists are rarely the best choice of data structure. Most of the time a contiguous resizable vector (already implemented in the standard libraries of most languages these days) is superior in almost every way. --- "life is overrated" - Seiichi Omori 01001100 01010101 01000101 00100000 00110100 00110000 00110010 ... Copied to Clipboard!
|
Tyranthraxus 12/10/22 10:55:07 PM #16: |
AlephZero posted... Tbh linked lists are rarely the best choice of data structure. Most of the time a contiguous resizable vector (already implemented in the standard libraries of most languages these days) is superior in almost every way. "Built in lists" are secretly trees where you can't see them which are the superior data structure anyway. --- It says right here in Matthew 16:4 "Jesus doth not need a giant Mecha." https://i.imgur.com/dQgC4kv.jpg ... Copied to Clipboard!
|
warlock7735 12/11/22 2:31:35 AM #17: |
[LFAQs-redacted-quote] Best i can think of in that scenario is double iteration wit a worst case of nsquared. Iterate forwards so you don't check for a combination you've already checked. Technically the run time would be something along the lines of nC2, but setting that up would still quirk out to about nsquared. --- CE Mafia Archive https://www.dropbox.com/sh/u3gaka98zsp3m0e/AADYBrilDyGYhlAbpEnac5d_a?dl=0 ... Copied to Clipboard!
|
TheMikh 12/11/22 3:30:37 AM #18: |
warlock7735 posted... Linked list is easier to insert something g into the middle of, worse for accessing valuesunless it's indexed --- http://i.imgur.com/A0TAfek.png ... Copied to Clipboard!
|
SomeLikeItHoth 12/11/22 5:31:10 AM #19: |
This video is pretty good. I'll need to watch it one or two more times to fully digest it. I did not expect the code to be 130+ lines long. I underestimated the power of a Linked List. https://youtu.be/ZBdE8DElQQU AlephZero posted... figure out how to detect a loop in a linked list and congrats you can now pass many senior software developer interviewshttps://imgur.com/uqmBOkt warlock7735 posted... Linked list is easier to insert something g into the middle of, worse for accessing valuesThe code from the video above gave a very simple example. Do you have a better example of what I could use a Linked List for? I watched another video that said Linked Lists are good for queues and stacks so I just assumed programmers used them for stuff like shopping carts on low stock items. Or when buying tickets for an upcoming show. --- FAM FOREVER. | https://imgur.com/cGrHeeU.jpg ... Copied to Clipboard!
|
warlock7735 12/11/22 8:06:25 AM #20: |
SomeLikeItHoth posted... The code from the video above gave a very simple example. Do you have a better example of what I could use a Linked List for? I watched another video that said Linked Lists are good for queues and stacks so I just assumed programmers used them for stuff like shopping carts on low stock items. Or when buying tickets for an upcoming show. I haven't used a linked list ever since college. I just use the built in c# List<> which is an expandable vector. Best of both worlds, kinda. --- CE Mafia Archive https://www.dropbox.com/sh/u3gaka98zsp3m0e/AADYBrilDyGYhlAbpEnac5d_a?dl=0 ... Copied to Clipboard!
|
SHRlKE 12/11/22 8:14:54 AM #21: |
Just use blockchain. ... Copied to Clipboard!
|
Questionmarktarius 12/11/22 2:58:32 PM #22: |
warlock7735 posted... I haven't used a linked list ever since college. I just use the built in c# List<> which is an expandable vector. Best of both worlds, kinda.Those college classes don't teach you structures you'll ever actually use after the test about it, but instead beat into your head a vague understanding of what's going on under the hood of the in-built object-types you actually will use. ... Copied to Clipboard!
|
#23 | Post #23 was unavailable or deleted. |
AlephZero 12/11/22 3:11:02 PM #24: |
warlock7735 posted... Best i can think of in that scenario is double iteration wit a worst case of nsquared. Iterate forwards so you don't check for a combination you've already checked. Technically the run time would be something along the lines of nC2, but setting that up would still quirk out to about nsquared.The "best" way to do it --- "life is overrated" - Seiichi Omori 01001100 01010101 01000101 00100000 00110100 00110000 00110010 ... Copied to Clipboard!
|
Questionmarktarius 12/11/22 3:16:33 PM #25: |
Add a sentinel bit to the list item definition. Then, iterate through the whole list:
... Copied to Clipboard!
|
Tyranthraxus 12/11/22 4:53:09 PM #26: |
Questionmarktarius posted... Add a sentinel bit to the list item definition. You're often not going to be able to change the definition of the object. --- It says right here in Matthew 16:4 "Jesus doth not need a giant Mecha." https://i.imgur.com/dQgC4kv.jpg ... Copied to Clipboard!
|
Tyranthraxus 12/11/22 4:55:17 PM #27: |
AlephZero posted... The "best" way to do it --- It says right here in Matthew 16:4 "Jesus doth not need a giant Mecha." https://i.imgur.com/dQgC4kv.jpg ... Copied to Clipboard!
|
#28 | Post #28 was unavailable or deleted. |
VirtuousWrath 12/11/22 5:12:25 PM #29: |
Imagine being forced to make a linked list in JavaScript --- "I sung of chaos and eternal night, taught by the heav'nly muse to venture down the dark descent, and up to reascend... ... Copied to Clipboard!
|
Tyranthraxus 12/11/22 5:17:00 PM #30: |
[LFAQs-redacted-quote] The head is just the node you start at. Var a = head; Do stuff; Var b = a; a = a.next; While (&a != &b) { Do stuff; a = a.next } Print "loop detected"; needs to be adjusted on a per language basis but you get the idea --- It says right here in Matthew 16:4 "Jesus doth not need a giant Mecha." https://i.imgur.com/dQgC4kv.jpg ... Copied to Clipboard!
|
#31 | Post #31 was unavailable or deleted. |
Tyranthraxus 12/11/22 5:25:54 PM #32: |
[LFAQs-redacted-quote] If D.next = D.prev.next then you fucked up. A less memory efficient way of preventing this is to simply maintain a separate vector of every & and if your vector contains the current & then stop. --- It says right here in Matthew 16:4 "Jesus doth not need a giant Mecha." https://i.imgur.com/dQgC4kv.jpg ... Copied to Clipboard!
|
#33 | Post #33 was unavailable or deleted. |
Questionmarktarius 12/11/22 5:29:01 PM #34: |
[LFAQs-redacted-quote] There's not a lot of easy ways to find a loop that loops several nodes back. If you can't mess with the class itself for a sentinel, clone the entire list. Then iterate the clone while unsetting prior nodes. When you ht a null pointer, you've either found a loop or some other serious problem with the list. ... Copied to Clipboard!
|
#35 | Post #35 was unavailable or deleted. |
Tyranthraxus 12/11/22 5:35:17 PM #36: |
[LFAQs-redacted-quote] I just mean in general having an internally looping list is caused only by buggy code that inserts or rearranges the list. I was originally under the impression that loop meant the tail.next = head but if it isn't if there is an end, "E" that you just can't ever get to because D sends you back to C, that's a separate issue. --- It says right here in Matthew 16:4 "Jesus doth not need a giant Mecha." https://i.imgur.com/dQgC4kv.jpg ... Copied to Clipboard!
|
Questionmarktarius 12/11/22 5:41:37 PM #37: |
[LFAQs-redacted-quote] The pointers will eventually collide, but there's no telling how many times the pointers will loop. Well, maybe orbit around the looped part twice. ... Copied to Clipboard!
|
#38 | Post #38 was unavailable or deleted. |
Questionmarktarius 12/11/22 5:45:49 PM #39: |
[LFAQs-redacted-quote] derp. I'm thinking of actual useful vector objects. ... Copied to Clipboard!
|
#40 | Post #40 was unavailable or deleted. |
Questionmarktarius 12/11/22 5:58:18 PM #41: |
The loop itself will be a 2:1 orbital resonance, so that won't take too long. Waiting on slow pointer to get there will be most of the time. ... Copied to Clipboard!
|
#42 | Post #42 was unavailable or deleted. |
#43 | Post #43 was unavailable or deleted. |
Questionmarktarius 12/11/22 6:17:02 PM #44: |
[LFAQs-redacted-quote] Competent languages have a Vector object that implements linked lists and trees, and a couple other things I forgot right after the test. All you get out the college courses is an understanding of what a linked list is. ... Copied to Clipboard!
|
#45 | Post #45 was unavailable or deleted. |
Questionmarktarius 12/11/22 6:18:35 PM #46: |
[LFAQs-redacted-quote] Not really, no. At least not until postgrad. ... Copied to Clipboard!
|
#47 | Post #47 was unavailable or deleted. |
#48 | Post #48 was unavailable or deleted. |
Questionmarktarius 12/11/22 6:22:57 PM #49: |
[LFAQs-redacted-quote] Yes. A college degree is a "gatekeeper" now, if you want any decent job. ... Copied to Clipboard!
|
#50 | Post #50 was unavailable or deleted. |
Topic List |
Page List:
1, 2 |