Category: Arrays Searching and Sorting

Arrays Searching and Sorting

Hashing Functions

Hashing Functions

Some of the methods of defining a hash function are discussed in the following paragraphs. Modular Arithmetic In modular arithmetic, first the key is converted to an integer, then it is divided by the...

Hashing

Hashing

A data object called a symbol table is required to be defined and implemented in many applications, such as compiler/assembler writing. A symbol table is nothing but a set of pairs (name, value), where...

Binary Search

Binary Search

The prerequisite for using binary search is that the list must be a sorted one. We compare the element to be searched with the element placed approximately in the middle of the list.  ...

Heapsort

Heapsort

Heapsort is a sorting technique that sorts a contiguous list of length n with O(n log2 (n)) comparisons and movement of entries, even in the worst case. Hence it achieves the worst-case bounds better...

Merge Sort

Merge Sort

This is another sorting technique having the same average-case and worst-case time complexities, but requiring an additional list of size n.   The technique that we use is the merging of the two sorted...

Quick Sort

Quick Sort

In the quick sort method, an array a[1],…..,a[n] is sorted by selecting some value in the array as a key element. We then swap the first element of the list with the key element...

Bubble sort in C

Bubble sort in C

Bubble sorting is a simple sorting technique in which we arrange the elements of the list by forming pairs of adjacent elements. That means we form the pair of the ith and (i+1)th element....

Transpose of a matrix

Transpose of a matrix

The transpose of a matrix is obtained by interchanging the rows with the corresponding columns. Let matrix a be. The diagonal elements are the same both in matrix a and in the matrix obtained...

Application of Arrays

Application of Arrays

Whenever we require a collection of data objects of the same type and want to process them as a single unit, an array can be used, provided the number of data items is constant...