- Data Structures & Algorithms
- DSA - Home
- DSA - Overview
- DSA - Environment Setup

- Algorithm
- DSA - Algorithms Basics
- DSA - Asymptotic Analysis
- DSA - Greedy Algorithms
- DSA - Divide and Conquer
- DSA - Dynamic Programming

- Data Structures
- DSA - Data Structure Basics
- DSA - Array Data Structure

- Stack & Queue
- DSA - Stack
- DSA - Expression Parsing
- DSA - Queue

- Searching Techniques
- DSA - Linear Search
- DSA - Binary Search
- DSA - Interpolation Search
- DSA - Hash Table

- Sorting Techniques
- DSA - Sorting Algorithms
- DSA - Bubble Sort
- DSA - Insertion Sort
- DSA - Selection Sort
- DSA - Merge Sort
- DSA - Shell Sort
- DSA - Quick Sort

- Graph Data Structure
- DSA - Graph Data Structure
- DSA - Depth First Traversal
- DSA - Breadth First Traversal

- Tree Data Structure
- DSA - Tree Data Structure
- DSA - Tree Traversal
- DSA - Binary Search Tree
- DSA - AVL Tree
- DSA - Spanning Tree
- DSA - Heap

- DSA Useful Resources
- DSA - Questions and Answers
- DSA - Quick Guide
- DSA - Useful Resources
- DSA - Discussion

# Multiple Lists in a Single Array in Data Structure

Array representation is basically wasteful of space when it is storing data that will change over time. To store some data, we allocate some space which is large enough to store multiple values in an array. Suppose we use the array doubling criteria to increase the size of the array.

Consider the current array size is 8192. This is full. So we need to increase it by using array doubling technique. So new array size will be 16384. Then copy 8192 elements from old array to new array, then deallocate the old array. Now we can realize that before deallocating the space of the old array, the array size is thrice of 8192. The new array with double size and the old array. That is not so good approach.

When we want to store several lists we can share some larger array instead of creating new array for new lists. The multiple list in one array will be look like this −

Though the multiple list in single array is memory efficient, but it has some problem also. Here insertion operation is more expensive. Because it may be necessary to move elements belonging to other lists to insert some element in the current list. And the representation is also harder to implement.

- Related Articles
- Skip Lists in Data Structure
- Generalized Lists in Data Structure
- Array Doubling in Data Structure
- ADT-array Representation in Data Structure
- How to combine multiple R data frames stored in multiple lists based on a common column?
- Array of Arrays Representation in Data Structure
- What is an array data structure in Java?
- How to get single array from multiple arrays in JavaScript
- Multiple COUNT() for multiple conditions in a single MySQL query?
- How to multiply row values in a data frame having multiple rows with single row data frame in R?
- Rectangle Data in Data Structure
- Append multiple lists at once in Python
- Searching a Graph in Data Structure
- Adjacency lists in Data Structures
- How to convert multiple columns into single column in an R data frame?