Saturday, 22 October 2016

Array

Array -
It is container Object that holds fixed no of elements of single type.

//Declaration
int[] arr = new int[10]
or
int[] arr ={1,2,3,4,5,6,7,8,9,10}
In declaration we can place [] whenever we want.
int[] arr
int arr[]
int []arr

All are valid cases.
//coping Array 
System.copyArray (copyFrom,2,copyTo,0,7) 
will copy Array From  copyFrom[] 3rd element onwards to copyTo
Algorithm to search data in array 

1. Linear Search Algorithm -
It starts searching the data at index 0 and continues examining successive elements until data is found or no more elements remain to examine.

Pseudocode  -














Actual Code -

No comments:

Post a Comment