Currently browsing tag

Structure

Data Structure Hashing and Hash Table Generation using CC

Data Structure – Hashing and Hash Table Generation using C/C++ Hashing is the transformation of a string of characters into a usually shorter fixed-length value or key that represents the original string. Hash Function A function that transforms a key into a table index is called a hash function. If …

Data Structure Implementing Tree Sort in C

Data Structure: Implementing Tree Sort in C++ In tree sort, the given data is first converted into a binary tree. The inorder traversal of the binary tree results in the sorted form which is known as tree sort. Algorithm 1. Declare and initialize necessary variables.2. Input the array of element …

Data Structure How to implement Shell Sort in C

Data Structure: How to implement Shell Sort in C++? Shell is generalization of insertion sort and is devised by Donald Shell in 1954. The method sorts separate sub-files of original file i.e. Divide the original file into smaller sub-files. Sort individual sub-files using any sorting algorithm We choose increment ‘k’ …

Data Structure How to implement Merge Sort in C

Data Structure: How to implement Merge Sort in C++? Merging is the process of combining two or more sorted files into a third sorted file. Merge sort is based on the divide and conquer paradigm. It can be explained as …. Let A[p…..r] is given array with indices p = …

Data Structure How to implement Straight Insertion Sort in C

Data Structure: How to implement Straight Insertion Sort in C++? An insertion sort is that which sort a record of data by inserting records into an existing sorted file. The list is divided into two parts: sorted and unsorted. In each pass, the first element of the unsorted sub-list is …

Data Structure How to implement Straight Insertion Sort in C

Data Structure: How to implement Straight Insertion Sort in C++? An insertion sort is that which sort a record of data by inserting records into an existing sorted file. The list is divided into two parts: sorted and unsorted. In each pass, the first element of the unsorted sub-list is …

Data Structure How to implement Straight Selection Sort in C

Data Structure: How to implement Straight Selection Sort in C++? In selection sort, In each pass smallest/largest element is selected and placed in a sorted list. Th entire array is divided into two parts: sorted and unsorted In each pass, in the unsorted subarray, the smallest element is selected and …

Data Structure Implementing Quick Sort using CC

Data Structure: Implementing Quick Sort using C/C++ Algorithm 1. Declare and initialize necessary variables2. Pick a pivot element.3. FInd the proper position of the pivot element4. Divide the total array into two sub arrays so that all elements of the left sub array are less than pivot and that of …

Data Structure Implementing Bubble Sort using CC

Data Structure: Implementing Bubble Sort using C/C++ In Bubble sort, each pass consists of comparison each element in the file with its successor (i.e. x[i] with x[i+1]) and interchanging two elements if they are not in the proper order. Example: Let us consider following array of elements 16 52 42 …

Data Structure What is linked list

Data Structure: What is linked list? Following points illustrates about what is linked list. It is a special list of some data elements linked to one another. Logical ordering is represented by having each elements pointing to next element. each element is called node, which has two parts, (a) Info …

Data Structure Implementation of Queue in C

Data Structure: Implementation of Queue in C++ A queue is an order collection of items from which items may be deleted at one end (called front or head of the queue) and into which items may be inserted at the other end (called the rear end  or tail of the …

Data Structure Stack implementation in C

Data Structure: Stack implementation in C++ (A) Top of stack varying method Algorithm for top of stack varying method 1. Declare and initialize necessary variables, eg top = -1, MAXSIZE etc.2. For push operation, If top = MAXSIZE – 1 print ” stack overflow” else top = top + 1; …

Adding two complex numbers using Structure in C

Adding two complex numbers using Structure in C Simple algebraic addition do no work in the case of Complex Number. Because they have two parts, Real and Imaginary. To add two complex numbers, real part of one number must be added with real part of other and imaginary part one …