Arnab Chakraborty has Published 4293 Articles

Heterogeneous Arrays in Data Sturcture

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Aug-2020 08:11:28

1K+ Views

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 ... Read More

Array Doubling in Data Structure

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Aug-2020 08:10:07

2K+ Views

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 ... Read More

Sorted Arrays in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Aug-2020 08:08:12

638 Views

Here we will see some basic concepts of the sorted arrays. The arrays are homogeneous data structure to hold same kind of data in some consecutive memory locations. Sometimes we need to sort the elements to use them. Other than that we can make a sorted array. That will always ... Read More

Substitution Method in Data Structure

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Aug-2020 08:05:13

6K+ Views

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 ... Read More

Recurrence Equations in Data Structure

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Aug-2020 08:02:46

1K+ Views

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 ... Read More

Counting Cache Misses in Data Structure

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Aug-2020 08:01:20

311 Views

In algorithm analysis we count the operations and steps. This is basically justified when computer takes more time to perform an operation than they took to fetch the data needed for that operation. Nowadays the cost of performing an operation is significantly lower than the cost of fetching data from ... Read More

Operation Counts Method in Algorithm

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Aug-2020 07:57:52

4K+ Views

There are different methods to estimate the cost of some algorithm. One of them by using the operation count. We can estimate the time complexity of an algorithm by choosing one of different operations. These are like add, subtract etc. We have to check how many of these operations are ... Read More

Dequeue and Priority Queue in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Aug-2020 07:54:44

2K+ Views

As we know that the queue data structure is First in First Out data structure. The queue has some variations also. These are the Dequeue and the Priority Queue.The Dequeue is basically double ended queue. So there are two front and two rear pairs. One pair of front and rear ... Read More

Circular Queue Data Structure in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Aug-2020 07:53:01

2K+ Views

A queue is an abstract data structure that contains a collection of elements. Queue implements the FIFO mechanism i.e the element that is inserted first is also deleted first.Queue cane be one linear data structure. But it may create some problem if we implement queue using array. Sometimes by using ... Read More

Find median of BST in O(n) time and O(1) space in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Jul-2020 16:43:10

896 Views

ConceptWith respect of a given Binary Search Tree(BST), our task is to determine median of it.For even no. of nodes, median = ((n/2th node + (n+1)/2th node) /2 For odd no. of nodes, median = (n+1)/2th node.For given BST(with odd no. of nodes) is −       7     ... Read More

Advertisements