Skip to content

Latest commit

 

History

History

Array

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Array

An array is a list of elements of the same type, identified by a pair of square brackets [ ]. It is a collection of items stored at contiguous memory locations. To use an array, you need to declare the array with 3 things: a name, a type and a dimension (or size, or length).

The syntax is:

type arrayName[arraylength]

Array in Memory

Advantages

  • Random access of elements using array index.

  • Use of less line of code as it creates a single array of multiple elements.

  • Easy access to all the elements.

Disadvantages

To create an array, you need to known the length (or size) of the array in advance, and allocate accordingly. Once an array is created, its length is fixed and cannot be changed. At times, it is hard to ascertain the length of an array. Nonetheless, you need to estimate the length and allocate an upper bound. This is probably the major drawback of using an array.

##Questions

  • Counting rotations in a sorted array ---> Python
  • Factorials of big numbers ----> C++
  • Find duplicate in array ----> C++ | Java
  • Finding All subset ----> C++
  • Insertion_at_start ----> C++ | Java | Python
  • Inverse of Array ----> Java | C++ | Python
  • Job Sequencing Problem ----> C++
  • Kadane's Algorithm ----> C++
  • K Largest Element ----> C++ | [Java](/Code/Java/K Largest Elements.java)
  • Left_rotation ----> Python
  • Minimum Merge Operation ----> Python
  • Merging two sorted arrays in O(1) space ---->C++
  • Most Occured Element in Array ----> Java
  • Peak element in array using linear search ----> C++ | Java
  • Repeating and Missing Number ----> C++ | Java
  • Rotation Count in a sorted array ----> Python
  • Subset Sum Greater than X ----> C++
  • Search in sorted rotated array ----> Python
  • Sliding Window Maximum ---->C++
  • Split Array Largest Sum ----> CPP | Java
  • Sorted Zig-Zag Array ----> C++
  • Subarray with palindromic concatenation ----> C++
  • Three Sum ----> Python
  • Union and Intersection of 2 Array ----> Java
  • Union of two Arrays ----> C++
  • Union of two Unsorted Arrays ----> C++
  • Unsorted Zig-Zag Array ----> C++
  • Kth Minimum in array ---->Python
  • Insertion_at_start ----> C++ | Java | Python
  • Kadane's Algorithm ----> C++