
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1860 Articles for Data Structure
Minimum cost of path between given nodes containing at most K nodes in a directed and weighted graph

411 Views
Introduction The issue of finding the minimum cost of a path between two given nodes in a directed and weighted graph, whereas ensuring that the path contains at most K nodes, may be a significant challenge in chart hypothesis. This issue has different applications in differing domains, counting transportation systems, logistics planning, and network optimization. In this article, we have investigated two distinctive approaches to handling this issue using C language. Each approach utilizes a special algorithmic procedure to discover the least cost path whereas considering the constraint on the number of nodes in the way. Approach 1: Dynamic Programming ... Read More

114 Views
Introduction The problem of finding the minimum number of moves to make two given numbers M and N rise by repeatedly including any divisor of a number (except 1 and the number itself) can be approached without utilizing Dynamic Programming. In this issue, we are required to plan methodologies that minimize the number of moves required to attain the specified uniformity. Two approaches are displayed to handle this issue: Greedy Algorithm, Prime Factorization. These approaches utilize distinctive strategies to recognize common divisors and optimize the method of making the numbers rise to investigate these non-Dynamic Programming approaches, we will pick up ... Read More

201 Views
Introduction The issue at hand is to determine the number of distinct shortest ways from Node 1 to Node N in a weighted and directed graph. We are given a graph representation comprising of nodes and edges, where each edge encompasses a weight related with it. Our objective is to create an algorithm that can effectively calculate the count of particular shortest ways, taking into consideration the weighted nature of the graph. For this issue, we have presented three diverse approaches to decide the number of particular shortest ways. The primary approach utilizes a Depth-First Search (DFS) algorithm, the second ... Read More

104 Views
Introduction In graph theory, nodes and edges form the fundamental units of connected structures. They are widely used to represent a broad range of relationships and connections between different entities. In this article, we will dive into an interesting problem involving counting graphs formed by changing the color of red-colored nodes with black parent nodes in C++. We will explain the concept behind graph coloring, introduce an algorithmic approach to solve this problem, and provide a detailed C++ code implementation that we can use. Count of graphs formed by changing color Graph coloring is a concept that involves assigning colors ... Read More

124 Views
Introduction In the world of programming, arrays play a fundamental role and are extensively used in various applications. Often, while working with large arrays, we come across situations where we need to determine to which array each element in each set of queries belongs. In this article, we will explore an efficient approach using C++ to find the corresponding array for each query along with the count of elements. The task at hand is to identify which array each query element belongs to and generate a count for those specific arrays. Find the array to which each element in given ... Read More

142 Views
Introduction In the area of programming and data structures, binary trees are widely used to store and retrieve data efficiently. In this article, we will explore the concept of constructing a prime binary tree from a given non-cyclic graph consisting of N indices using C++ code. The Binary tree can be constructed from the non-cyclic graph and the types of this graph are tree, directed acyclic graph and some more. A prime tree comes under the division of binary tree which returns the prime number by appending the two consecutive edges of the graph. Construct a Prime Binary Tree from ... Read More

545 Views
Introduction In graph theory, a Hamiltonian path is a sequence of vertices that visits each vertex exactly once, with no repeated edges. It is named after Sir William Rowan Hamilton, an Irish mathematician who contributed significantly to various fields, including graph theory. In this article, we will dive deep into understanding and counting all possible Hamiltonian paths within a directed graph using C++ programming. Now, it's up to us to apply these principles and unlock the secrets concealed within different types of directed graphs. Count all Hamiltonian paths in a given directed graph A directed graph consists of a set ... Read More

139 Views
In this problem, we need to construct the original string from the given string. The given string is formed from the original string using the given rules. Here, we can use the given encryption rule and encrypted string to find the decrypted string by applying the encryption rule in reverse order. Problem statement – We have given a binary string bin_str of length N and positive integer k. The binary string is constructed from the ‘enc’ string by following the below operations and using the x value. If enci-k is equal to 1, bin_stri is equal to 1. If ... Read More

225 Views
Introduction In the area of graph theory, unweighted bidirectional graphs form a fundamental framework for modeling various real-world scenarios. These graphs allow us to explore relationships between different entities, such as road networks or social connections. One key aspect that captures our attention is finding paths between two nodes and determining their respective lengths. In this article, we dive into one interesting facet of this topic – understanding the distinction between the shortest path and second shortest path in an unweighted bidirectional graph. Shortest and second shortest path Unweighted bidirectional (or undirected) graphs consist of vertices or nodes connected by ... Read More

347 Views
In this problem, we will find a minimum number of string characters needed to be replaced to make all characters. In the first approach, we will find the minimum count of the replaceable characters by counting the frequency of each character in the given string. In another approach, we will determine the cost to convert all string characters to a particular character and take the minimum value from that. Problem statement – We have given a string alpha containing N alphabetical characters. We need to find the minimum number of characters to replace to make all string characters equal. Sample ... Read More