Array Data Structure
Learn more about Array in DSA Self Paced Course
Practice Problems on Arrays
Recent articles on Arrays
What is Array?
An array is a collection of items stored at contiguous memory locations. The idea is to store multiple items of the same type together. This makes it easier to calculate the position of each element by simply adding an offset to a base value, i.e., the memory location of the first element of the array (generally denoted by the name of the array).
The above image can be looked as a top-level view of a staircase where you are at the base of the staircase. Each element can be uniquely identified by their index in the array (in a similar way as you could identify your friends by the step on which they were on in the above example).
Topics :
- What is Array
- Introduction to Arrays – Data Structure and Algorithm Tutorials
- Applications, Advantages and Disadvantages of Array
Introduction of Array in Different language:
- Searching in Array
- Write a program to reverse an array
- Left Rotate an Array
- Right rotate an Array
- Search, insert and delete in an unsorted array
- Search, insert and delete in a sorted array
- Sort an Array
- Generate all subarrays
- Easy
- Find the largest three elements in an array
- Find Second largest element in an array
- Move all zeroes to end of array
- Rearrange array such that even positioned are greater than odd
- Rearrange an array in maximum minimum form using Two Pointer Technique/a>
- Segregate even and odd numbers
- Reversal algorithm for array rotation
- Print left rotation of array in O(n) time and O(1) space
- Sort an array in wave form
- Sort an array which contain 1 to n values
- Count the number of possible triangles
- Print All Distinct Elements of a given integer array
- Find the element that appears once in Array where every other element appears twice
- Leaders in an array
- Find sub-array with given sum
- Medium
- Rearrange an array such that arr[i] = i
- Rearrange positive and negative numbers in O(n) time and O(1) extra space
- Reorder an array according to given indexes
- Search an element in a sorted and rotated array
- Find the Rotation Count in Rotated Sorted array
- K-th Largest Sum Contiguous Subarray
- Find the smallest missing number
- Difference Array | Range update query in O(1)
- Maximum profit by buying and selling a share at most twice
- Smallest subarray with sum greater than a given value
- Inversion count in Array using Merge Sort
- Sort an array of 0s, 1s and 2s
- Merge two sorted arrays with O(1) extra space
- Majority Element
- Two Pointers Technique
- Find a peak element
- Find a triplet that sum to a given value
- Minimum increment by k operations to make all elements equal
- Equilibrium index of an array
- Hard
- Find k numbers with most occurrences in the given array
- MO’s Algorithm
- Square Root (Sqrt) Decomposition Algorithm
- Sparse Table
- Range sum query using Sparse Table
- Range Minimum Query (Square Root Decomposition and Sparse Table)
- Range LCM Queries
- Merge Sort Tree for Range Order Statistics
- Minimum number of jumps to reach end
- Space optimization using bit manipulations
- Sort a nearly sorted (or K sorted) array
- Find maximum value of Sum( i*arr[i]) with only rotations on given array allowed
- Median in a stream of integers (running integers)
- Construct an array from its pair-sum array
- Maximum equlibrium sum in an array
- Smallest Difference Triplet from Three arrays
- Find all triplets with zero sum
- Minimum increment by k operations to make all elements equal
GeeksforGeeks Courses:
Complete Interview Preparation
Get fulfilled all your interview preparation needs at a single place with the Complete Interview Preparation Course that provides you with all the required stuff to prepare for any product-based, service-based, or start-up company at the most affordable prices.
Live Courses
GFG Live Classes offers Interactive LIVE and Self-Paced Courses with Individual Attention from Industry Leading Experts to Encourage Out-of-the-Box Thinking, Leading to Clarity in Concepts, Creativity, and Innovative Ideas. Clear your doubts with the instructor, just like an offline classroom program. Check out GeeksforGeeks valuable Live Courses. – System Design Live, Competitive Programming Live, and more!
Language Foundation Courses[C Programming / C++ / JAVA / Python ]
Master any programming language from scratch and understand all its core fundamental concepts for a solid programming foundation at a pocket-friendly price with help of GeeksforGeeks Language Foundation Courses– C Programming | Java Foundation | Python Foundation | C++ Foundation. These courses are designed for complete beginners who want to get started with programming and build their foundations.
Recomended:
- Learn Data Structure and Algorithms | DSA Tutorial
- Introduction to Arrays – Data Structure and Algorithm Tutorials
- Introduction to Matrix or Grid – Data Structure and Algorithms Tutorial
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above