---
title: "Difference between an array and a linked list in terms of memory allocation and insertion/deletion."  
description: "Difference between an array and a linked list in terms of memory allocation and insertion/deletion."  
author: "Sandra Emily"  
published: 2023-08-06  
updated: 2023-08-07  
canonical: https://www.mindstick.com/forum/159484/difference-between-an-array-and-a-linked-list-in-terms-of-memory-allocation-and-insertion-deletion  
category: "data structure"  
tags: ["array", "data structure"]  
reading_time: 2 minutes  

---

# Difference between an array and a linked list in terms of memory allocation and insertion/deletion.

[Difference](https://www.mindstick.com/articles/157114/good-news-or-bad-news-and-the-difference-is) between an [array](https://www.mindstick.com/articles/335/jagged-array-in-c-sharp-dot-net) and a [linked](https://answers.mindstick.com/qa/104773/how-to-create-a-linked-list) list in [terms](https://answers.mindstick.com/qa/31698/what-is-the-real-value-of-us-dollars-in-terms-of-indian-rupee) of [memory allocation](https://www.mindstick.com/forum/159479/what-are-the-differences-between-new-and-malloc-for-memory-allocation-in-c-plus-plus) and insertion/deletion.

## Replies

### Reply by Aryan Kumar

Sure. Here are the key differences between an array and a linked list in terms of [memory](https://www.mindstick.com/blog/300050/what-causes-sudden-memory-loss) allocation and insertion/deletion:

## Memory allocation

- **Arrays:** Arrays are allocated in contiguous memory blocks. This means that all the elements of an array are stored next to each other in memory.
- **Linked lists:** Linked lists are not allocated in contiguous memory blocks. Each node in a linked list stores the data for the element and a pointer to the next node in the list.

## Insertion/deletion

- **Arrays:** Insertion and deletion in arrays can be slow, especially if the element being inserted or deleted is not at the beginning or end of the array. This is because the elements of the array need to be shifted to make room for the new element or to close the gap left by the deleted element.
- **Linked lists:** Insertion and deletion in linked lists is much faster than in arrays. This is because the new element or the deleted element can be simply inserted or deleted from the list without having to shift any of the other elements.

Here is a table that summarizes the key differences between arrays and linked lists in terms of memory allocation and insertion/deletion:

| Feature | Arrays | Linked lists |
| --- | --- | --- |
| Memory allocation | Contiguous | Not contiguous |
| Insertion | Slow | Fast |
| Deletion | Slow | Fast |


---

Original Source: https://www.mindstick.com/forum/159484/difference-between-an-array-and-a-linked-list-in-terms-of-memory-allocation-and-insertion-deletion

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
