Linked Lists — Singly vs Doubly
Unlike arrays, linked lists store data in individual nodes that are connected through references.

ᅠ 📘 Engineering Notes | From Concepts to Code — Post 24 ᅠ As I continue learning Data Structures and Algorithms, I've been exploring Linked Lists and how they differ from arrays.
Unlike arrays, linked lists store data in individual nodes that are connected through references.
Each node contains some data and a reference to another node.
There are two common types of linked lists that I've been learning about. ᅠ Singly Linked List
In a singly linked list, each node contains data and a reference to the next node.
10 → 20 → 30 → null
We can only move in one direction, from the first node to the last.
It's simple and requires less memory per node than a doubly linked list. ᅠ Doubly Linked List
In a doubly linked list, each node contains data and two references: one to the previous node and another to the next node.
null ← 10 ⇄ 20 ⇄ 30 → null
This allows us to move in both directions, but it also requires additional memory to store the previous reference. ᅠ What about Time Complexity?
For both types of linked lists:
• Accessing an element by index — O(n)
• Searching for an element — O(n)
• Inserting at the beginning — O(1)
• Deleting the first node — O(1) ᅠ One thing I found interesting is that linked lists don't need to shift other elements when inserting or deleting a node.
However, finding the right position can still take O(n) time.
Understanding these differences is helping me see why choosing a data structure depends on what we're trying to solve.
Still learning, one concept at a time. ᅠ #Java #DSA #DataStructures #LinkedList #SoftwareEngineering