❖ SEARCHING: Searching is the process of finding a particular item in a
collection of items.Searching requires a key field.When the key field of a
target item is found, a pointer to the target item is returned. The pointer may be an address, an index into a vector or array, or some other indication of where to find the target. If a matching key field isn’t found, the user is informed.
Algorithm is the simplest search algorithm. In this search algorithm a sequential search is made over all the items one by one to search for the targeted item. Each item is checked in sequence until the match is found. If the match is found, particular item is returned otherwise the search continues till the end. 2. BINARY SEARCH:The Binary search works on the basis of divide and conquer rule. In this technique we have to sort the data collection in increasing/decreasing order first then search for the targeted item by comparing the middle most item of the collection. If match found, the index of item is returned. If the middle item is greater than the targeted item, the item is searched in the sub-array to the left of the middle item. Otherwise, the item is searched for in the sub-array to the right of the middle item. This process continues on the sub-array as well until the size of the sub array reduces to zero.
❖ SORTING:Sorting is the process of placing elements from a collection in
some kind of order. 1. BUBBLE SORT: It is based on comparison where each adjacent pair of element is compared and swapped if they are not in order. It works by repeatedly stepping through the list to be sorted, comparing two items at a time and swapping them if they are in the wrong order. After each Pass/Iteration the largest element gets sorted first.
2. SELECTION SORT:Selection sort is an in-place comparison sort.In this
technique smallest element is interchanged with first element of array.The second smallest element is interchanged with second element of the array.This process of searching the next smallest element and placing it in its proper position continues until all records have been sorted in increasing order. 3. INSERTION SORT:Insertion sort is an in-place sorting algorithm based on comparison. The sorted array is built having one item at a time. The array elements are compared with each other sequentially and then arranged simultaneously in some particular order. 4. QUICK SORT: Quick sort is a well-known sorting algorithm. It is highly efficient and also known as partition exchange sort. In this sorting algorithm the array is divided into 2 sub array. One contain smaller values than pivot value and other array contain elements having greater values than pivot value. Quick sort partitions an array and then calls itself recursively twice to sort the two resulting sub arrays. Pivot:Pivot is an element that is used to compare and divide the elements of the main array into two. 5. SHELL SORT:Shell sort is the generalization of insertion sort. It improves insertion sort by comparing elements separated by a gap of several positions. In this algorithm we avoid large shifts. This technique uses insertion sort on a widely spread elements, first to sort them and then sorts the less widely spaced elements. 6. MERGE SORT:Merge sort is a comparison based sorting algorithm. It is based on divide and conquer rule. In this algorithm we divide the array into equal halves first and then combines them in a sorted manner.