[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]

linked lists

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: 86
Thread images: 19

File: Unsorted:B 655.png (606KB, 800x1200px) Image search: [Google]
Unsorted:B 655.png
606KB, 800x1200px
>linked list
its better than arrays
>>
>>59980716
>no index
dropped
>>
It depends on use case
>>
I swear to god if the tripfag !ruby senpai posts in this thread I will be so freaking mad
>>
>>59980716
No, bit streams is the only data type needed.
>>
>>59980716
Linked lists are fundamental in implementing different data structures, but on their own, they're actually pretty shit.
Their locality of reference is terrible.
>>
File: Unsorted 1702.png (673KB, 800x1200px) Image search: [Google]
Unsorted 1702.png
673KB, 800x1200px
>>59980752
*sqeaky weirdo voice
well AKTUALLY a linekd list is 0n^3 memory while a array is o@s too replace items and blah blah blah blah im in my first year of CS bachelors btw
>>
>>59980757
Yes. Everyone should code only using bitstreams as their only data structure.
>>
>>59980803
defnitely
>>
>>59980733
>cant make a simple indexing function
>>
>>59980891
bloat
>>
>>59980716
>>59980767
Get b& avatarfag
>>
>>59980935
thats not the same girl retard
>>
You're such an attention starved flamboyant faggot OP
>>
>>59980956
not an argument
>>
>>59980968
but we arent arguing, sissy fag.
>>
>>59980977
buttblasted array user with no arguments
>>
>>59980978
perverted avatarfag lusting for cocks with no arguments.
>>
>>59981003
not an argument
>>
at what size is it a good idea to use arrays?
>>
>>59981006
yeah, you being a cock lusting faggot cant be argued
>>
>>59981010
yeah bc its not true baaka
>>
>>59981017
but it is, you effeminate cocksucker.
>>
>>59981008
About 9 inches
>>
lmao
>>
>>59980763
if that's true then why is lisp the best prgraooming language in the world?
>>
You’ll never win any algorithm contest using a linked list. They’re far slower than arrays
>>
File: Unsorted 1704.png (857KB, 800x1200px) Image search: [Google]
Unsorted 1704.png
857KB, 800x1200px
>>59981278
it isnt abou winning algorithm contests its about aesthetics
>>
This is what happens when your daddy neglects you gentlemen, look and learn...
>>
>>59981278
>algorithm contests
>>
>>59981334
lmao
>>
>>59980716
>>59980767
>>59981292
I think we should all fap to her at least once to honour her life.
>>
>>59980716

Linked lists only outperform arrays when it comes to data nodes that need to be swapped in and out randomly in the list frequently.

Otherwise, arrays are just contiguous blocks of RAM with known widths for the data nodes, so next to no calculations needed to iterate over a straight up array.
>>
>>59980716
You

Can't

Sort

It

In the trash quick
>>
>>59981503
>he doesnt have quick sort implemented for linked list
>>
>>59981517
Not so fast that's for a linked list of integers not my fucked up objects
>>
>>59981472
Who?
>>
I have a question /g/ !!

List<Character> list = Arrays.asList(array);


Tell me please what i just created in the code above? "ArrayList" or "LinkedList" ? Don't tell me "List" because it is just a interface.


List<Character> list = new ArrayList<Character>(Arrays.asList(array)); // this is arraylist
List<Character> list = new LinkedList<Character>(Arrays.asList(array)); // this is linkedlist
>>
>>59981517
that would be fucking slow
also
>what are cache lines
>>
>>59981534
Her.

>>59980716
>>59980767
>>59981292
>>
>>59981541
>array
>as list
what do you think
>>
>>59981541
Array list desu
>>
>implementing lists by hand
Even in C, you should be using libraries to work with lists or trees, not fucking with arrays by hand.
>>
>>59981562
>>59981571

So default is ArrayList wow it makes a sense now. Thanks.
>>
>>59980716
>>59980733
>>59980891
>>59981517
>>59981542
>>59981562
>>59981577
Who are you quoting?
>>
>>59980716
>O(n) search
>cache misses
>O(n) for the last element in most implementations
There is almost no case where linked lists are useful.
>>
>>59981923
lol retard
>>
File: 1490096026662.jpg (343KB, 1102x1200px) Image search: [Google]
1490096026662.jpg
343KB, 1102x1200px
>>59981923
And I forgot to mention, O(n) fetching an item at an index. Absolutely useless

If you really want a linked-list-based structure check out skip lists.

>>59981931
Nice arguments ;)
>>
File: Unsorted:B 669.png (676KB, 800x1200px) Image search: [Google]
Unsorted:B 669.png
676KB, 800x1200px
>>59981958
whats a skip list
desu i just like writing and using linked list functions alot more than array ones
>>
File: 1492318753612.png (176KB, 560x530px) Image search: [Google]
1492318753612.png
176KB, 560x530px
linked list is only cool because it's literally the first data structure you learn and the only one you know

arrays are more flexible and can be used to implement a linked list if required
>>
>array fags need the tail of the array
>creates an entire new array
meanwhile, in lists, all you need is to drop the first element
>>
File: 1468278620024.jpg (208KB, 600x445px) Image search: [Google]
1468278620024.jpg
208KB, 600x445px
>>59981967
>whats a skip list
This fun thing
https://en.wikipedia.org/wiki/Skip_list

>desu i just like writing and using linked list functions alot more than array ones
Just make an abstraction that can work with both Arrays and Linked lists. You have read your SICP, haven't you?

>>59981978
The first data structure that I implemented was a double linked list ;_;
>>
>>59980891
>O(n)
>>
File: 1484703785207.jpg (27KB, 600x450px) Image search: [Google]
1484703785207.jpg
27KB, 600x450px
>>59982006
int *
tail (int *x)
{
return x + 1;
}

???
>>
>>59982019
im talking immutable arrays
functional programming is the future, and this overused meme of pointers is long begone
arrays are only useful for O(1) access with index
>>
>>59982032
>im talking immutable arrays
Yes, what with them? The same thing applies.
>>
>>59982041
procedural/imperative programming can't be used
>>
File: Unsorted:B 661.png (590KB, 800x1200px) Image search: [Google]
Unsorted:B 661.png
590KB, 800x1200px
>>59982008
thats pretty cool
>>
File: 1482592324193.jpg (16KB, 400x317px) Image search: [Google]
1482592324193.jpg
16KB, 400x317px
>>59982054
Sure, just do it in a functional language.
Again, what is the problem?

Also, the following could be valid in a functional programming language
const int *
tail (const int *x)
{
return x + 1;
}


No mutable state and no IO.
>>
>>59980716

only if you're doing random inserts/deletes
>>
ared lisp lists faster than haskell lists?
>>
>>59982095
No because both of them are programming languages, not implementations.
>>
>>59982104
are sbcl lists faster than ghc lists?
>>
File: Unsorted:B 662.png (735KB, 800x1200px) Image search: [Google]
Unsorted:B 662.png
735KB, 800x1200px
gcc lists vs clang
just look at the atnime girl <--
>>
File: 1487778546867.jpg (146KB, 1920x1080px) Image search: [Google]
1487778546867.jpg
146KB, 1920x1080px
>>59982132
Neither of them provide linked lists to the user applications.
>>
File: Unsorted:B 668.png (583KB, 800x1200px) Image search: [Google]
Unsorted:B 668.png
583KB, 800x1200px
>>59982156
what about javascript double o(n log) aray links
>>
File: 1473262377594.png (795KB, 800x1200px) Image search: [Google]
1473262377594.png
795KB, 800x1200px
>>59982171
idk mane, nobody uses javaschit anymore
>>
File: Unsorted:B 660.png (580KB, 800x1200px) Image search: [Google]
Unsorted:B 660.png
580KB, 800x1200px
>>59982206
dam u doxed me!11!
>>
>>59982232
suck my cock
>>
File: 1475638216612.png (754KB, 800x1200px) Image search: [Google]
1475638216612.png
754KB, 800x1200px
>>59982232
I guess we can agree that he is best artist
>>
File: Unsorted 1719.png (461KB, 800x1200px) Image search: [Google]
Unsorted 1719.png
461KB, 800x1200px
>>59982259
they're perfect
>>
File: java_collections.png (121KB, 1048x1236px) Image search: [Google]
java_collections.png
121KB, 1048x1236px
>>59980716

Linked lists when you don't know how much data you have and resize a lot, when you need to insert and delete valuers a lot and don't need fast access to elements.

Arrays when the size stays more or less the same and you have a lot of read/write operations or need searching and sorting a lot.


>I have a matrix which gets initialized once and then used for lookup operations a lot of times

Use an array


>I need to store incoming requests, but sometimes those requests get deleted again before I process them

Use a linked list


Also there are much more data structures, sometimes you want an Array-List, a doubly-linked list, a Red-Black-Tree, a Radix tree...
>>
>>59982054
FYI, Haskell's vector and array libraries have O(1) slice operations, for both immutable and mutable arrays/vectors.

(tfw took the bait)
>>
>>59982347
>Java
>>
>>59980716
Linked lists for fast push/pop
Array lists for searching for a specific index
Hash map for storing more than one set of data into an array
Use what you need.
>>
>>59981583
>>>/jp/
>>
>>59982516

>Linked lists for fast push/pop
But you can implement that easily with an ArrayList.
Linked lists are for inserts/deletes at arbitrary indices.
>>
>not just using really big structs
>>
>>59982206
>>59980716

GOD BLESS ANIME FOOTPUSSY
>>
>>59982557
>ArrayList
No such thing.
>>
>>59982894

Call it a vector if you want to split hairs.
>>
nice b8 m8
program more and read some more books, fa/g/
>>
File: 1463833925829.jpg (48KB, 330x319px) Image search: [Google]
1463833925829.jpg
48KB, 330x319px
>>59981542
>doesn't know how to implement quick sort to linked lists efficiently
Lmao at your life
>>
This is why I come to /g/
>>
>>59982016
Just because indexing is built into other languages doesn't mean it isn't O(n)
>>
>>59980716

>O(n) indexing
>fragmented in memory causes cache misses

No
Thread posts: 86
Thread images: 19


[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.