Search⌘ K
AI Features

Linked List vs Array

Explore the differences between linked lists and arrays, focusing on memory allocation, advantages, and trade-offs. Understand why linked lists offer dynamic sizing over fixed-size arrays. Learn about types of linked lists and their use in programming contests, preparing you to implement and manipulate these structures efficiently.

We'll cover the following...

Why do we need a list

A major problem with arrays is that the size is fixed. For example, adjacency list representation of a graph is not possible with 2-D arrays. It’s fine if you don’t know what adjacency list is just yet, we’ll discuss that in later chapters. But this is just an example of why we need arrays that are dynamic in size. ...