Introduction To Java
Introduction To Java
Arrays: Java provides a data structure, the array, which stores a fixed-size
sequential collection of elements of the same type. An array is used to store a
collection of data, but it is often more useful to think of an array as a collection of
variables of the same type. Arrays are basically divided into two types: One
Dimensional and Two Dimensional.
Selection sort- In this technique, successive rounds are executed to select the
elements in some order and place them into their positions.
Bubble sort- This technique is widely used for sorting elements. In this
technique, the array is sequentially scanned several times and during each
iteration, the pairs of consecutive elements are compared and interchanged,
if necessary, to bring them to a specific order.
Insertion sort- It is based on the principle of insertion of the elements in the
required position.
Merge sort- In this technique, elements of two arrays are merged into a
single array and then the merged array is sorted in order using any of the
above techniques.
Searching: It is a process to determine whether a given item is present in an array
or not. This can be done in two ways: