Coding Journal

Jordan Vidrine

Daily Coding Journal

A Self-taught coder from the Cajun Prairie in rural Louisiana, currently working as a designer for Discourse.

I am always trying to better myself, and do so through learning new skills, trying out new routines, traveling, and pouring energy into hobbies. Since 2014, I have been recording, editing, and producing my own music under the name Skies Speak.

Data Structures!

Data structures are collections of values, the relationships among them, and the functions or operations that can be applied to the data.

Different data structures excel at different things. Some are highly specialized, while others (like arrays) are more generally used.

The more time you spend as a developer, the more likely you’ll need to use one. We’ve already worked with many of them unknowingly. ALSO! They are used in interviews!!

Use Cases ?

Working with map/location data? - Use a graph!!

Inserts/Removals at beginning and end of an ordered list? - Use a Linked List!!

Web Scraping HTML? - Use a tree!!

Singly Linked Lists

A Linked List is a data structure that contains a head, tail, and length property. Linked Lists consist of nodes, and each node has a value & a pointer to another node, or null. There is no index like in arrays to access items.

// HEAD       LENGTH = 4        TAIL
// --------------------------------
// |                              |
// |                              |
// |                              |
// 4--------> 6-------> 8-------> 2
//     next      next      next     null

A good way to think of linked lists is in the comparison to elevators and stairs. An array is a good example of an elevator, where the index can take you to whatever element you need.

A linked list however is more like a staircase. Each stair takes you to the next level or item in the list. note - visualgo is a great resource for data structures!

Creating our Singly Linked List

class Node {
    this.val = val; = null;

class SinglyLinkedList {
    this.length = 0;
    this.head = null;
    this.tail = null;


As an exercise, I will create a push method that accepts a value, and creates a new node using the value passed to the function.

Back to blog...