No, not usually. My advice is to always use the standard collection types (or, if needed, a type out of the Swift Algorithms collections) where possible, and then, after profiling, use something like a custom collection. The reason is that the standard collection types (Array, Set, Dictionaries) are ridiculously well optimised (for both speed and memory). And they're not necessarily "arrays" or "dictionaries" at all. The actual algorithms employed are dependant on how many items are in the collection. These are battle-tested implementations. It's always good to know how to write a linked list. But we almost never want to write our own. Cheers.
In what sense is the Linked List more efficient than an array? In terms of coding efficiency? Execution efficiency? Both? My intuition is that it is not more efficient in terms of execution time but gives benefits for coding...?
@12:56. You are appending a new node to the end of a list. So this newNode's previous link should be to the old tailNode!? If I am the new node and I look backwards, I'll see what USED to be the old tail. @13:33 you explicitly assign your newest node to the tail. But any node in your list that has a nextNode value of nil is, by definition, the tail node. So why do you have to make the assignment?
It's right over here: th-cam.com/video/fUk9hLLPvqo/w-d-xo.htmlsi=Wkzk47fwnzvReZbs Next Discover the 5 Best View Extensions in SwiftUI 👇 th-cam.com/video/n9Amll3lY9I/w-d-xo.html&ab_channel=Rebeloper-RebelDeveloper
Do you think that Singly Linked List is better than array?
No, not usually.
My advice is to always use the standard collection types (or, if needed, a type out of the Swift Algorithms collections) where possible, and then, after profiling, use something like a custom collection.
The reason is that the standard collection types (Array, Set, Dictionaries) are ridiculously well optimised (for both speed and memory). And they're not necessarily "arrays" or "dictionaries" at all. The actual algorithms employed are dependant on how many items are in the collection. These are battle-tested implementations.
It's always good to know how to write a linked list. But we almost never want to write our own.
Cheers.
In what sense is the Linked List more efficient than an array? In terms of coding efficiency? Execution efficiency? Both? My intuition is that it is not more efficient in terms of execution time but gives benefits for coding...?
@12:56. You are appending a new node to the end of a list. So this newNode's previous link should be to the old tailNode!? If I am the new node and I look backwards, I'll see what USED to be the old tail.
@13:33 you explicitly assign your newest node to the tail. But any node in your list that has a nextNode value of nil is, by definition, the tail node. So why do you have to make the assignment?
What font do you use in your xcode? How are you able to display ≥ and -> differently?
It's right over here:
th-cam.com/video/fUk9hLLPvqo/w-d-xo.htmlsi=Wkzk47fwnzvReZbs
Next Discover the 5 Best View Extensions in SwiftUI 👇
th-cam.com/video/n9Amll3lY9I/w-d-xo.html&ab_channel=Rebeloper-RebelDeveloper
Csak így tovább ! Kedves, érthető, érdekes :-) Szeretem :-)
Koszonom. Thanks :) BTW master Generics here: th-cam.com/video/OEurXzRPLak/w-d-xo.html
Thanks I had not heard of a linked list.
Glad to help