Found 217 Articles for Analysis of Algorithms

Binary Heap in Data Structure

Arnab Chakraborty
Updated on 10-Aug-2020 08:46:41
Heap or Binary Heap is a special case of balanced binary tree data structure. This is complete binary tree structure. So up to l-1 levels it is full, and at l level, all nodes are from left. Here the root-node key is compared with its children and arranged accordingly. If a has child node b then −key(a) ≥ key(b)As the value of parent is greater than that of child, this property generates Max Heap. Based on this criteria, a heap can be of two types the Max Heap and the Min Heap.These are examples of Max and Min Heap respectively ... Read More

Threaded Binary Trees in Data Structure

Arnab Chakraborty
Updated on 10-Aug-2020 08:39:09
Here we will see the threaded binary tree data structure. We know that the binary tree nodes may have at most two children. But if they have only one children, or no children, the link part in the linked list representation remains null. Using threaded binary tree representation, we can reuse that empty links by making some threads.If one node has some vacant left or right child area, that will be used as thread. There are two types of threaded binary tree. The single threaded tree or fully threaded binary tree. In single threaded mode, there are another two variations. ... Read More

Generalized Lists in Data Structure

Arnab Chakraborty
Updated on 10-Aug-2020 08:37:45
In this section we will see the generalized lists. The generalized list can be defined as below −A generalized list L is a finite sequence of n elements (n ≥ 0). The element ei is either an atom (single element) or another generalized list. The elements ei that are not atoms, they will be sub-list of L. Suppose L is ((A, B, C), ((D, E), F), G). Here L has three elements sub-list (A, B, C), sub-list ((D, E), F), and atom G. Again sub-list ((D, E), F) has two elements one sub-list (D, E) and atom F.In C++, we ... Read More

Sparse Matrices in Data Structure

Arnab Chakraborty
Updated on 10-Aug-2020 08:23:11
In this section we will see what is the sparse matrix and how we can represent them in memory. So a matrix will be a sparse matrix if most of the elements of it is 0. Another definition is, a matrix with a maximum of 1/3 non-zero elements (roughly 30% of m x n) is known as sparse matrix.We use matrices in computers memory to do some operations in an efficient way. But if the matrices are sparse in nature, it may help us to do operations efficiently, but it will take larger space in memory. That spaces have no ... Read More

Irregular Arrays in Data Structure

Arnab Chakraborty
Updated on 10-Aug-2020 08:19:28
Here we will see the Irregular arrays. Before discussing the irregular arrays, we have to know what are regular arrays. The regular arrays are that kind of arrays, where the number of columns in each row is same. Or in other words, when each row is holding same number of elements, then that is regular arrays. The following representation is a regular array.From the definition of regular array, we can understand what are the irregular arrays. So in irregular arrays, each row may or may not contain same number of elements. This kind of irregular arrays can also be represented ... Read More

Array of Arrays Representation in Data Structure

Arnab Chakraborty
Updated on 10-Aug-2020 08:17:35
In this section we will see another representation of multidimensional arrays. Here we will see the Array of Arrays representation. In this form, we have an array, that is holding the starting addresses of multiple arrays. The representation will be look like this.This is a two-dimensional array x of size [7 x 8]. Each row is represented as a single onedimensional array. The initial array is holding the addresses of these single arrays. They are array of addresses, so we can say that, it is an array of pointers. Each pointer is holding addresses of another arrays.create this kind of ... Read More

Heterogeneous Arrays in Data Sturcture

Arnab Chakraborty
Updated on 10-Aug-2020 08:11:28
As we know the arrays are homogeneous by definition. So we have to put data of same type in an array. But if we want to store data of different type, then what will be the trick? In C like old languages, we can use unions to artificially coalesce the different types into one type. Then we can define an array on this new type. Here the kind of object that an array element actually contains is determined by a tag. Let us see one structure like this −struct Vehicle{    int id;    union {       Bus ... Read More

Array Doubling in Data Structure

Arnab Chakraborty
Updated on 10-Aug-2020 08:10:07
Sometimes we create array using dynamic memory allocation. If the array is allocated using dynamic memory allocation technique, we can double the size of array by performing some operations.Suppose initial array size was 5.Array01234Element 1Element 2Element 3Element 4Element 5After array doubling, the size is −0123456789Element 1Element 2Element 3Element 4Element 5Element 6Element 7Element 8Element 9Element 10To double the size of array arr of size n, arr[0…n-1]. At first we have to create one new array of size say m. Then copy n elements from arr to the new array. Finally change the value of arr to point to the new array.To ... Read More

Substitution Method in Data Structure

Arnab Chakraborty
Updated on 10-Aug-2020 08:05:13
Here we will see how to use substitution method to solve recurrence relations. We will take two examples to understand it in better way.Suppose we are using the binary search technique. In this technique, we check whether the element is present at the end or not. If that is present at middle, then the algorithm terminates, otherwise we take either the left and right subarray from the actual array again and again. So in each step the size of the array decreases by n / 2. Suppose the binary search algorithm takes T(n) amount of time to execute. The base ... Read More

Recurrence Equations in Data Structure

Arnab Chakraborty
Updated on 10-Aug-2020 08:02:46
During analysis of algorithms, we find some recurrence relations. These recurrence relations are basically using the same function in the expression. In most of the cases for recursive algorithm analysis, and divide and conquer algorithm we get the recurrence relations.Here we will see one example of recurrence equation by the help of some examples. Suppose we are using the binary search technique. In this technique, we check whether the element is present at the end or not. If that is present at middle, then the algorithm terminates, otherwise we take either the left and right subarray from the actual array ... Read More
Previous 1 ... 6 7 8 9 10 ... 22 Next
Advertisements