Found 1907 Articles for Data Structure

Check if every row in given Matrix contains all the integers from 1 to N

Vanshika Sood
Updated on 25-Oct-2023 11:52:35

37 Views

A matrix is a two-dimensional data structure made up of rows and columns set out like a grid of squares. Grids, multidimensional arrays, and tabular data are frequently represented using it. Problem Statement We are given a matrix of dimensions and the task is to check whether each row of the matrix consists of every number from 1 to n. The order of the numbers in the row do not matter. Return true if this statement holds true else return false. For Example Input: mtx = [[1, 2, 3], [3, 2, 1], [2, 1, 3]] Output: True ... Read More

Find the last remaining Character in the Binary String according to the given conditions

Disha Gupta
Updated on 23-Oct-2023 15:43:53

28 Views

A binary string is a string that only has two characters, usually the numbers 0 and 1, and it represents a series of binary digits. Problem Statement Now, in this problem, we are given a binary string comprising zeros and ones. We have two conditions to keep in mind while solving the problem. First, one digit can delete another digit that is a ‘1’ can delete a ‘0’ and vice versa. Secondly, if at any moment the entire string consists of only 0’s and 1’s then the corresponding digit is printed. Here, a binary string will be the input given ... Read More

Cliques In Graph

Satadru Jati
Updated on 09-Oct-2023 14:32:06

1K+ Views

Recently, graph-based representations have gained enormous popularity for simulating real-world data. Cliques are a key issue in graph theory that is used to solve numerous mathematical issues and create graphs. Cliques are extensively researched in the field of computer science, with the clique problem assessing if a clique having a certain size within a graph is NP-complete.  Yet, in spite of all complexities, there has been research into several techniques for finding cliques. What Are Cliques? In all undirected graphs G = (N, E), a clique, is a "subset of the nodes", so that all pairs of distinct nodes is ... Read More

Applications, Advantages and Disadvantages of Unweighted Graph

Satadru Jati
Updated on 09-Oct-2023 12:34:19

200 Views

How Do Graphs Work? A group of things that are connected is referred to as a graph. They may represent anything at all, from based on merely mathematical ideas, to real-life objects, events and occurrences. For instance, a graph represents a list of individuals with a family connection. Similarly, a network of metropolitan areas is linked together by roadways. Typically, we describe the elements of the network as nodes or vertices, while the links among them are referred to as edges or arcs. Pic 1 − Visual Representation of a Graph with Nodes and Edges Unweighted Graph: What Is ... Read More

Prove That Dense Subgraph Is NP-Complete By Generalisation

Satadru Jati
Updated on 09-Oct-2023 12:32:56

243 Views

Even with limitless time, algorithms are unable to resolve all computer problems. The answer to NP-complete problems remains unknown. It's worth noting that when single NP-complete issue is able to be answered in polynomial time, then all others may be resolved as well. Dense Subgraph A dense subgraph is one that has numerous edges for each vertex in the theory of graphs and computer science. Clique A clique constitutes a subsection of a graph in which every vertex is linked to every other vertex, making the "subgraph" a full graph.  "Maximal Clique Problem" aims for locating the largest clique in ... Read More

Prove That A Problem Consisting Of Clique And Independent Set Is Np-Complete

Satadru Jati
Updated on 09-Oct-2023 12:31:10

363 Views

There is no solution to "NP-complete" problems. So far, there hasn't been a polynomial time method developed for any NP-complete problem, nor has anyone shown that there isn't one. There is an intriguing fact about NP-complete problems: if one manages to be resolved under polynomial time, all are within reach. In this post, we'll prove that a problem comprising an independent set and clique is NP-Complete. Clique A clique refers to a "subgraph" of a graph in which every node is connected to one another, implying that the subsection is a complete graph. NP-Class The NP in the NP class ... Read More

Travelling Salesman Problem (TSP) Using Reduced Matrix Method

Satadru Jati
Updated on 02-Nov-2023 16:15:29

655 Views

The travelling salesman problem is a popular topic in AI and operational research. Since its first articulation, a plethora of publications have been written providing various solutions to this problem. Furthermore, a slew of novel formulations has been presented by associated practitioners in an attempt to broaden the application of the fundamental TSP. Travelling Salesman Problem: Definition Formally defined, the travelling salesman problem (TSP) is as follows - Discover the shortest way that covers each city "precisely once and returns to the initial city" when provided with a collection of cities and distances between each city. More On The Problem ... Read More

Prove That Sparse Graph Is Np-Complete

Satadru Jati
Updated on 09-Oct-2023 12:26:00

149 Views

Even with infinite time, there are some computing issues that algorithms cannot resolve. NP-complete problems are those whose solution is unknown. It's intriguing to note that if one NP-complete question can be resolved in polynomial time, subsequently, all others can be resolved. In this study, we will define a sparse graph, discuss several complexity classes, independent sets, and demonstrate that sparse graphs are NP-complete. What Is A Sparse Graph? A sparse graph is one with a limited number of edges. The total number of edges in this situation is significantly fewer than there could be or the highest possible number ... Read More

Minimize Colors to Paint Graph Such That No Path Has Same Color

Satadru Jati
Updated on 09-Oct-2023 12:24:08

100 Views

Graph coloring is a subset of graph labelling in graph theory. The use of colors stems from coloring the nations on a map, wherein each face is colored. There are several real-world applications for graph coloring, as well as issues of theory. Apart from the traditional forms of problems, other constraints can be imposed on the graph, the manner a color is given, or even the color itself. It has even gained widespread appeal in the shape of the renowned numerical puzzle Sudoku. Graph coloring remains an active area of study. What Is Vertex Coloring? The assignment of colors or ... Read More

Monotonic Shortest Path from Source to Destination in Directed Weighted Graph

Satadru Jati
Updated on 09-Oct-2023 12:21:33

347 Views

Pathfinding algorithms are based on graph search techniques that study paths between nodes, starting with one node and progressing via connections until the objective is attained. In this post, we'll talk about weighted graphs and how to calculate the monotonic shortest route between source and end node in a directed weighted graph. What Are Weighted Graphs? A weighted graph combines a graph with a weight function. That is, it assigns an integer weight to every edge. There are multiple uses for edge weights for a graph − Network Connection Latency  Road Network Distances The Strength of a social network interaction ... Read More

Previous 1 ... 3 4 5 6 7 ... 191 Next
Advertisements