## Hash Tables for Integer Keys in Data Structure

Updated on 10-Aug-2020 09:18:22
Here we will discuss about the Hash tables with the integer keys. Here the key values 𝑥 comes from universe 𝑈 such that 𝑈 = {0, 1, … , 𝑢 – 2, 𝑢 – 1}. A hash function is ℎ. The domain of this hash function is 𝑈. The range is in the set {0, 1, … , 𝑚 – 1}, and 𝑚 ≤ 𝑢.A hash function h is said to be a perfect hash function for a set 𝑆 ⊆ 𝑈 if for every 𝑥 ∈ 𝑆, ℎ(𝑥) is unique. A perfect hash function ℎ for 𝑆 is minimal ... Read More

## Deletion from a Max Heap in Data Structure

Updated on 10-Aug-2020 09:15:38
Here we will see how to delete elements from binary max heap data structures. Suppose the initial tree is like below −Deletion Algorithmdelete(heap, n) − Begin    if heap is empty, then exit    else       item := heap[1]       last := heap[n]       n := n – 1       for i := 1, j := 2, j = heap[j], then break          heap[i] := heap[j]       done    end if    heap[i] := last EndExampleSuppose we want to delete 30 from the final heap −

## Insertion into a Max Heap in Data Structure

Updated on 10-Aug-2020 09:13:15
Here we will see how to insert and elements from binary max heap data structures. Suppose the initial tree is like below −Insertion Algorithminsert(heap, n, item) − Begin    if heap is full, then exit    else       n := n + 1       for i := n, i > 1, set i := i / 2 in each iteration, do          if item

## Fibonacci Heaps in Data Structure

Updated on 10-Aug-2020 09:10:31
Like Binomial heaps, Fibonacci heaps are collection of trees. They are loosely based on binomial heaps. Unlike trees with in binomial heaps are ordered trees within Fibonacci heaps are rooted but unordered.Each node x in Fibonacci heaps contains a pointer p[x] to its parent, and a pointer child[x] to any one of its children. The children of x are linked together in a circular doubly linked list known as child list of x. Each child y in a child list has pointers left[y] and right[y] to point left and right siblings of y respectively. If node y is only child ... Read More

## Binomial Heaps in Data Structure

Updated on 10-Aug-2020 09:09:08
A binomial Heap is a collection of Binomial Trees. A binomial tree Bk is an ordered tree defined recursively. A binomial Tree B0 is consists of a single node.A binomial tree Bk is consisting of two binomial tree Bk-1. That are linked together. The root of one is the left most child of the root of the otherSome binomial heaps are like below −Some properties of binomial trees are −Binomial tree with Bk has 2k nodes.Height of the tree is kThere are exactly $$\left(\begin{array}{c}k\ j\end{array}\right)$$ nodes at depth i for all i in range 0 to kBinomial HeapA binomial heap ... Read More

## Eulerian and Hamiltonian Graphs in Data Structure

Updated on 10-Aug-2020 09:06:22
In this section we will see the Eulerian and Hamiltonian Graphs. But before diving into that, at first we have to see what are trails in graph. Suppose we have one graph like below −The trail is a path, which is a sequence of edges (v1, v2), (v2, v3), …, (vk - 1, vk) in which all vertices (v1, v2, … , vk) may not be distinct, but all edges are distinct. In this example one trail is {(B, A), (A, C), (C, D), (D, A), (A, F)} This is a trail. But this will not be considered as simple ... Read More

## Depth-First Search on a Digraph in Data Structure

Updated on 10-Aug-2020 09:04:54
The Depth first search for graphs are similar. But for Digraphs or directed graphs, we can find some few types of edges. The DFS algorithm forms a tree called DFS tree. There are four types of edges called −Tree Edge (T) − Those edges which are present in the DFS treeForward Edge (F) − Parallel to a set of tree edges. (From smaller DFS number to larger DFS number, and Larger DFS completion number to Smaller DFS completion number)Backward Edge (B) − From larger DFS number to Smaller DFS number and Smaller DFS completion number to Larger DFS completion number.Cross ... Read More

## Searching a Graph in Data Structure

Updated on 10-Aug-2020 09:03:06
We know that the graph is one non-linear data structure. In this data structure, we put some values into nodes, and the nodes are connected though different edges. As we can store data into the graph structure, we also need to search elements from the graph to use them.For searching in graphs, there are two different methods. The Breadth First Search and the Depth First searching techniques.Breadth First Search (BFS)The Breadth First Search (BFS) traversal is an algorithm, which is used to visit all of the nodes of a given graph. In this traversal algorithm one node is selected and ... Read More

## Weighted Graph Representation in Data Structure

Updated on 10-Aug-2020 09:01:23
As we know that the graphs can be classified into different variations. They can be directed or undirected, and they can be weighted or unweighted. Here we will see how to represent weighted graph in memory. Consider the following graph −Adjacency matrix representationTo store weighted graph using adjacency matrix form, we call the matrix as cost matrix. Here each cell at position M[i, j] is holding the weight from edge i to j. If the edge is not present, then it will be infinity. For same node, it will be 0.0∞63∞30∞∞∞∞∞02∞∞110∞∞4∞20Adjacency List representationIn the adjacency list, each element in the ... Read More

## Insertion and Deletion in Heaps in Data Sturcture

Updated on 10-Aug-2020 08:59:32
Here we will see how to insert and delete elements from binary heap data structures. Suppose the initial tree is like below −Insertion Algorithminsert(heap, n, item): Begin    if heap is full, then exit    else       n := n + 1       for i := n, i > 1, set i := i / 2 in each iteration, do          if item
Previous 1 ... 5 6 7 8 9 ... 22 Next