I am getting runtime error while running the following code on leetcode 48; class Solution { public: void rotate(vector<vector<int>>& matrix) {vector<vector<int>>copy; for(int i=0;i<matrix.size();i++) { for(int j=0;j<matrix.size();j++) { copy[j][matrix.size()-i-1]=matrix[i][j]; } } for(int i=0;i<matrix.size();i++) { for(int j=0;j<matrix.size();j++) { matrix[i][j]=copy[i][j]; }} }}; as Line 1034: Char 9: runtime error: reference binding to null pointer of type ‘std::vector<int, std::allocator>’ ..

I have a directed Graph data structure that implements the hits algorithm, to find the authority and hub values of each vertex in the Graph. I used a 2D vector for an adjacency matrix representation. I have two boolean values (iter_bound & err_bound)that are the stopping condition for the algorithm. I have the stopping condition ..

I am trying to declare an array that is sized at runtime/compile through an overload constructor. private: auto** arr = new int[n][n]; overloadConstruct(int n){ arr[n][n] = {0,0}; } This does not work, it says the second n needs to be constant and auto is not allowed. Any help would be appreciated. I am not sure ..

So I m trying to implement Kruskal MST for a adjacency matrix and i have a 2d array that represent the adjacency matrix. I know I need to sort the edges from lowest to highest weight in order to proceed with the algorithm but how do i get the edges from the matrix itself. i ..

Say you have an adjacency matrix: 00000 11101 00000 1s represent nodes that are connected to other 1s, and 0s are unconnected. The last 1 in the 2nd row is almost connected to the others. It’s separated by one node. How do you identify occurrences like that? My initial though it to have some sort ..

Hello everyone, a weird issue is occurring with me. I am making a program that will read a file (Vertex file) that has one word per line and will construct an adjacency matrix representation of a graph. there are 5757 words in the file. Then in another file (Edge File) has the edges between the ..

I have an adjacency matrix for a graph. And I need to output all the cycles in this graph. How can I do this using dfs? void al_dfs(int tmp_vertex,int** Graph,vector<int>& color,int number,vector<int>& result){ color[tmp_vertex] = 1; for(int i = 0;i<number;i++){ if((color[i] == 0)){ al_dfs(i,Graph,color,number,result); result.push_back(i); }; if((color[i] == 1)){ for(int i = 0;i< result.size();i++) cout ..