>linked list
its better than arrays
Linked lists
Other urls found in this thread:
>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
No, bit streams is the only data type needed.
Linked lists are fundamental in implementing different data structures, but on their own, they're actually pretty shit.
Their locality of reference is terrible.
*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
Yes. Everyone should code only using bitstreams as their only data structure.
defnitely
>cant make a simple indexing function
bloat
Get b& avatarfag
thats not the same girl retard
You're such an attention starved flamboyant faggot OP
not an argument
but we arent arguing, sissy fag.
buttblasted array user with no arguments
perverted avatarfag lusting for cocks with no arguments.
not an argument
at what size is it a good idea to use arrays?
yeah, you being a cock lusting faggot cant be argued
yeah bc its not true baaka
but it is, you effeminate cocksucker.
About 9 inches
lmao
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
it isnt abou winning algorithm contests its about aesthetics
This is what happens when your daddy neglects you gentlemen, look and learn...
>algorithm contests
lmao
I think we should all fap to her at least once to honour her life.
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.
You
Can't
Sort
It
In the trash quick
>he doesnt have quick sort implemented for linked list
Not so fast that's for a linked list of integers not my fucked up objects
Who?
I have a question Sup Forums !!
List 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 list = new ArrayList(Arrays.asList(array)); // this is arraylist
List list = new LinkedList(Arrays.asList(array)); // this is linkedlist
that would be fucking slow
also
>what are cache lines
Her.
>array
>as list
what do you think
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.
So default is ArrayList wow it makes a sense now. Thanks.
Who are you quoting?
>O(n) search
>cache misses
>O(n) for the last element in most implementations
There is almost no case where linked lists are useful.
lol retard
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.
Nice arguments ;)
whats a skip list
desu i just like writing and using linked list functions alot more than array ones
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
>whats a skip list
This fun thing
en.wikipedia.org
>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?
The first data structure that I implemented was a double linked list ;_;
>O(n)
int *
tail (int *x)
{
return x + 1;
}
???
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
>im talking immutable arrays
Yes, what with them? The same thing applies.
procedural/imperative programming can't be used
thats pretty cool
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.
only if you're doing random inserts/deletes
ared lisp lists faster than haskell lists?
No because both of them are programming languages, not implementations.
are sbcl lists faster than ghc lists?
gcc lists vs clang
just look at the atnime girl
Neither of them provide linked lists to the user applications.
what about javascript double o(n log) aray links
idk mane, nobody uses javaschit anymore
dam u doxed me!11!
suck my cock
I guess we can agree that he is best artist
they're perfect
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...
FYI, Haskell's vector and array libraries have O(1) slice operations, for both immutable and mutable arrays/vectors.
(tfw took the bait)
>Java
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.
...
>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
GOD BLESS ANIME FOOTPUSSY
>ArrayList
No such thing.
Call it a vector if you want to split hairs.
nice b8 m8
program more and read some more books, fa/g/
>doesn't know how to implement quick sort to linked lists efficiently
Lmao at your life
This is why I come to Sup Forums
Just because indexing is built into other languages doesn't mean it isn't O(n)
>O(n) indexing
>fragmented in memory causes cache misses
No