Searching and Sorting
An array is a collection of similar types of data elements. An array has a fixed:name, type and Length. The array is categorised into two types One dimensional array and Two dimensional array. Arrays’ sizes cannot be changed during the execution of the code. Searching is a method of locating specific item of information in a larger collection of data. There are two types of Searching called linear search and binary search. Linear searching is also known as SEQUENTIAL SEARCH. It is simplest form of search. It search sequentially until desired item found or reach end of list. Another searching mechanism is binary search. The binary search works for the sorted list. Linear search works for both sorted and unsorted arrays, i.e., the array can be of any order, it checks whether a certain element is in a specified array or not.
Arranging data elements in a specified order such as ascending or descending order in called sorting. There are various sorting techniques like selection sort, bubble sort and Insertion Sort. Selection sort makes passes through the list. On each pass, select one smallest or one largest item to be correctly positioned. Exchange that item with the one that was in its place. Bubble sort compares each pair of adjacent elements from the beginning of an array and if they are in reversed order, swaps them. Selection sort is a simple sorting algorithm. It works by first looking the least element using a linear scan and exchanging it into the first spot in the list, then finding the second smallest element by checking the remaining elements and so on.
To Access the full content, Please Purchase
Name the two types of Sorting?Marks:1
Two types of sorting includes: Selection Sort and Bubble Sort.
Arranging an array or list in a specified order is known as sorting of an array.
Define Linear Search?Marks:1
Linear Search is a method for finding a particular value in a list that consists of checking every element until the desired one is found.
Name the two common searching techniques?Marks:1
The two common searching techniques are: 1.Linear Search 2.Binary Search.
What is an array?Marks:1
An array is a collection of variables having same data type.