What is an Array?
This lesson briefly defines arrays, and it's types. We will also discuss how arrays are stored in memory.
In this lesson, we will revise the basic concepts of Arrays and go through some practical examples to get a grip over this simple yet powerful data structure.
Introduction #
An array also referred to as a collection of elements, is the simplest and most widely used Data Structure. Most of the Data Structures (e.g.Stack and Queue) were derived using the Array structure, which is why it is known as one of the central building blocks of Data Structures. These Data Structures will be discussed later in the coming chapters. The purpose of an Array is to group similar kinds of data for fast access.
Look at the figure below; we have made a simple array with four elements. Each item in the collection is called a Data Element, and the number of data elements stored in an Array is known as its size. You can see that each data element has a maximum of two neighbors, except the first and last one.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.