Friday, 19 October 2018

Array ( Part 1 )




Today, we are going to learn ARRAY in java. An array is the most common and useful data structure in most of the programming language like C, C++, Java, python etc.



Ques - What is Array?

Answer - Array is a collection of homogeneous elements referred under a common name.




- Array is a group of the same kind of element. ( blue colour numbers )

- Array is homogeneous means all kind of elements of the same type. (all are int, double etc).

- Array referred under a common name (there is the only name for accessing it). 

- Array is an indexed based collection means it a group of element with some index number. ( red colour numbers )

- Array index always starts from 0 (zero) and end with size -1.

- Array is a fixed size data structure.

- Array is stored in a linearly (it is also called linear list).

- Hence, we can also difine Array As -  



Array is a data Structure that defines an index collection of a fixed number of homogeneous data elements and referred under a common name. 



For Example :




 Here,

"a" is the array name.

0 1 2 3 4  are the index number. [index always start from 0 and end with size-1 i.e., 4]

1 2 4 8 16 are the group of integer elements.

"a[0]" "a[1]" "a[2]" "a[3]" are index numbers to access each element separatly 

"a[0]" it is pronounced as " a " of  0. [ Array_Name  of  Index_Number ]




# Types Of Array


1) Single Dimension Array
2 ) Multi-dimensional Array



Will talk about these in our next post.....






No comments:

Post a Comment