Found 345 Articles for Data Structure Algorithms

Deaps in Data Structure

Arnab Chakraborty
Updated on 03-Jan-2020 05:35:07

1K+ Views

Deap is defined as a data structure which has no element or key value at the root node. It is formed by implementing the following rules −There is no element at root node that indicates root node is empty.Left subtree of the deap shall indicate min heap.Right subtree of deap shall indicate max heap.Thus, correctness to the following statement can be provided mathematically by a deap structure −If the left sub tree and right sub tree of certain nodes are non-empty, and their corresponding nodes can be represented by ‘a’ and ‘b’ respectively, then −a.KeyValue

Complexity of Interval Heap Operations

Arnab Chakraborty
Updated on 03-Jan-2020 05:27:43

148 Views

A double-ended priority queue(DEPQ) or interval heap features the following operations −isEmpty()This function performs to check if DEPQ is empty and returns true if empty.size()This function performs to return the total number of elements present in the DEPQ.getMin()This function performs to return the element having lowest priority.getMax()This function performs to return the element having maximum priority.put(z)This function performs to insert the element z in the DEPQ.removeMin()This function performs to remove an element with smallest priority and returns this element.removeMax()This function performs to remove an element with highest priority and returns this element.The operations isEmpty(), size(), getMin(), and getMax() consume O(1) ... Read More

Initializing an Interval Heap

Arnab Chakraborty
Updated on 03-Jan-2020 05:26:34

187 Views

An interval heap is same as an embedded min-max heap in which each node contains two elements. It is defined as a complete binary tree in whichThe left element is smaller than or equal to the right element.Both the elements define a interval which is closed.Interval represented by any node other than the root is a sub-interval of the parent node.Elements on the left hand side represent a min heap.Elements on the right hand side represent a max heap.Depending on the number of elements, two cases are permitted -Even number of elements: In this case, each node contains two elements ... Read More

Removing the Min Element from Interval Heaps

Arnab Chakraborty
Updated on 02-Jan-2020 07:55:44

258 Views

In an interval heap, the smallest element is the element on the left hand side of the root node. This element is eliminated and returned.For filling the vacancy created on the left hand side of the root node, an element from the last node is eliminated and again inserted into the root node.This element is next compared successively with all the left hand elements of the descending nodes and the process terminates when all the conditions for an interval heap are met.In case if the left hand side element in the node becomes higher than the right side element at ... Read More

Inserting an Element in Interval Heaps

Arnab Chakraborty
Updated on 02-Jan-2020 07:54:12

142 Views

Depending on the number of elements which are present in the interval heap, following cases are possible -Odd number of elements: If the number of elements in the interval heap be odd, the new element is inserted in the last node at first. Then, it is compared with the previous node elements successively and tested to meet the criteria essential for an interval heap. In case if the element does not meet any of the criteria, it is transferred from the last node to the root until all the conditions are met.Even number of elements: If the number of elements ... Read More

Symmetric Min-Max Heaps

Arnab Chakraborty
Updated on 13-Jul-2020 07:15:03

987 Views

A symmetric min-max heap (SMMH) is defined as a complete binary tree in which each node except the root has exactly one element. The root of an SMMH be empty and the total number of nodes in the SMMH is m + 1, where m is the number of elements.Let y be any node of the SMMH. Let elements(y) be the elements in the sub tree rooted at y but excluding the element (if any) in y. Assume that elements(y) j= ∅. y satisfies the following properties:The left child of y has the minimum element in elements(y).The right child of ... Read More

Double Ended Priority Queue (DEPQ)

Arnab Chakraborty
Updated on 02-Jan-2020 07:49:18

1K+ Views

A double-ended priority queue (DEPQ) or double-ended heap is defined as a data structure like a priority queue or heap, but permits for efficient removal of both the maximum and minimum, according to some ordering on the keys or items stored in the structure. Every element in a DEPQ associated with a priority or value. In a DEPQ, it is possible to eliminate or remove the elements in both ascending and descending order.OperationsA double-ended priority queue consists of the following operationsisEmpty()This function is responsible to check if DEPQ is empty and returns true if empty.size()This function is responsible to return the total ... Read More

Soft Heaps

Arnab Chakraborty
Updated on 02-Jan-2020 07:26:18

333 Views

A soft heap is defined as a variation on the simple heap data structure that consists of constant amortized time for 5 types of operations. This is obtained by carefully "corrupting" (increasing) the keys of maximum a certain number of values in the heap. The constant time operations are −create(s) − Create a new soft heap sinsert(s,  y) − Insert an element y into a soft heap smeld(s,  s' )of two soft heaps s and s′ into one, destroying bothdelete(s,  y) − Delete an element y from a soft heap sfindmin(s) − Get the element with least key in the soft ... Read More

Adaptive Properties of Pairing Heaps

Arnab Chakraborty
Updated on 02-Jan-2020 07:10:45

101 Views

Pairing heaps are implemented for a perfect use of a priority queue. A priority queue maintains track of the minimum of a set of objects, so every time we take something eliminate from the queue it is always the minimum value. Priority queues are mostly implemented when using Dijkstra’s Algorithm to calculate the shortest path in a graph.Pairing heaps are perfect because they are easy to use and operate well in real applications. Specifically, they operate excellent in amortized time . Meaning that while an individual operation consumes a longer time, the sum of all the operations over the whole ... Read More

Amortized Cost of Meld Operation

Arnab Chakraborty
Updated on 02-Jan-2020 07:05:43

247 Views

Calculating the amortized cost of meld operation is a difficult task. The major difficulty is in accumulating for the wide variations in the costs of an operation performed at different points in a random sequence of operations. Although our design goal is affected by the costs of sequence of operations, defining the notion of amortized cost of an operation in terms of the costs of sequences of operations leads nothing. Implementing a potential function to off set the variations in the actual costs is a perfect way of handling the situation.In the next topic we discuss the notion of amortized ... Read More

Advertisements