Skip to content

Latest commit

 

History

History
32 lines (27 loc) · 1.68 KB

Arrays_RoadMap.md

File metadata and controls

32 lines (27 loc) · 1.68 KB

Arrays

The array is the most basic but fundamental data structure. It is a data structure that is linear in nature. An array is a collection of homogeneous data types with contiguous memory allocations. Because memory is allocated in contiguous blocks, any element of an array can be accessed in constant time. Each array element is assigned a unique index number. The first topic that we start with within the Data Structures is Arrays.

How is an Array initialised?

The array is uninitialized by default, with no items set to any value. However, array initialization is required for the array to function properly. The following techniques can be used to initialise an array:

  1. Passing no value to the initializer: int arr[5] = { }
  2. By passing particular values to the initializer: int arr[5] = { 1 , 2 , 3 , 4 , 5 }
  3. By supplying specified values to the initializer but not stating the size: int arr[] = { 1 , 2 , 3 , 4 , 5 }
  4. Universal Initialization: int arr[] { 1 , 2 , 3 , 4 , 5 }

Operations on Array

  1. Insertion
  2. Access elements
  3. Searching

Types of Arrays

  1. One dimensional
  2. Multi-Dimensional Array

Applications on Array

  1. Applications on Array
  2. Arrays store data elements of the same type.
  3. Arrays are employed when the size of the data set is known.
  4. Used to solve matrix problems.
  5. In a computer, this is used as a lookup table.
  6. The array can also implement database records.
  7. Helps in the implementation of the sorting algorithm.
  8. Variables of the same type can be saved under a single name.
  9. Arrays can be utilised for CPU scheduling.
  10. Used to implement different data structures like as stacks, queues, heaps, hash tables, and so on.