Four months after graduating from Flatiron Software Engineering Program. After finishing up some projects started during the program, I turned my attention to learning computer science. Data structures than I’m moving along to algorithms

First Data structure on the list… Linked Lists!

So the most comparable data structure to Linked lists are arrays. I’m writing this article hoping the audience has some sense of what arrays are. SO I’m just going to slide pass explaining it.

Linked Lists are similar to array in the sense that they’re linear, but thats pretty much it an element in a linked list is call a node. A node contains its own information and some sort of pointer to the next node in the list. Okay basic definition is done.

Now let’s talk about the comparison

Arrays are equipped with a nice indexed based element design that makes accessing random elements in the array very easy. Linked Lists have to go through the head of the list every sequence to get to an element. Advantage Arrays.

A programming Language needs to allocate memory for a filled array, this making them fix in the location and if an element is added then the language must find a new area to place the array which could take TIME, first time mentioning TIME. Linked List nodes could be stored anywhere in memory and the pointer points to an address to the next node. Slow but predictable. advantage kinda Linked List.

I say kinda because iterating through an array is lightning fast but moving through a Linked List is predictable. Each iteration takes the same time even when we add new items to the Linked List.

Element movements, Arrays (whew) it’s easy to pop off elements from the end but everything else has behind the scenes cost that we don’t talk about. To remove an element from the head of the list shifts all other elements to adjust to the fact the head is changing. Linked List you just remove it. To insert a item to a Linked List you have to change what the previous points to and make the new item point to the item the previous was pointing towards and bam done. Arrays needs slicing or other methods. Meh

Advantage Linked List.

I emphasize time in the above section because time complexity is very important to data structures and algorithms. This will be explained in my next article.

Anyway back to the fight, Arrays have a complicated relationship with memory but at the end of the day its takes up less memory than Linked List because Linked List each node needs to have more memory to store the address to the next node. Advantage arrays

Ding Ding,

The end is here the winner is neither really.

As you can see above each structure has its own advantages and disadvantages and their own uses. I favor arrays more because I have more experiences interacting with them, and I’m having a hard time creating functions interacting with Linked List. Advantage Arra- joking that’s more of an indictment on me than Linked Lists. Anyway I know I’m missing some important points, these are the important points for me.

I’m enjoying my time learning new data structures I hope you will too. Thanks for reading.