Arnab Chakraborty

Arnab Chakraborty

3,768 Articles Published

Articles by Arnab Chakraborty

Page 218 of 377

Insertion into a Max Heap in Data Structure

Arnab Chakraborty
Arnab Chakraborty
Updated on 10-Aug-2020 7K+ Views

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

Read More

Eulerian and Hamiltonian Graphs in Data Structure

Arnab Chakraborty
Arnab Chakraborty
Updated on 10-Aug-2020 2K+ Views

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

Arnab Chakraborty
Arnab Chakraborty
Updated on 10-Aug-2020 723 Views

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

Arnab Chakraborty
Arnab Chakraborty
Updated on 10-Aug-2020 2K+ Views

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

Arnab Chakraborty
Arnab Chakraborty
Updated on 10-Aug-2020 20K+ Views

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

Arnab Chakraborty
Arnab Chakraborty
Updated on 10-Aug-2020 7K+ Views

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

Read More

Inorder Traversal of a Threaded Binary Tree in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 10-Aug-2020 5K+ Views

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.For fully threaded binary tree, each node has five fields. ...

Read More

Threaded Binary Trees in Data Structure

Arnab Chakraborty
Arnab Chakraborty
Updated on 10-Aug-2020 6K+ Views

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
Arnab Chakraborty
Updated on 10-Aug-2020 6K+ Views

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
Arnab Chakraborty
Updated on 10-Aug-2020 5K+ Views

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
Showing 2171–2180 of 3,768 articles
« Prev 1 216 217 218 219 220 377 Next »
Advertisements