- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 7347 Articles for C++
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
529 Views
To find the Vertex Connectivity of a graph we need to find out Articulation Points of that graph. Articulation Points (or Cut Vertices) in a Graph is a point iff removing it (and edges through it) disconnects the graph. An articulation point for a disconnected undirected graph, is a vertex removing which increases number of connected components.AlgorithmBegin We use dfs here to find articulation point: In DFS, a vertex w is articulation point if one of the following two conditions is satisfied. 1) w is root of DFS tree and it has at least two children. ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
439 Views
In this program to find the maximum Cut in a graph, we need to find the Edge Connectivity of a Graph. An Edge Connectivity of a Graph of a graph means it is a bridge, removing it graph will be disconnected. Number of connected components increases with the removing of bridge in a disconnected undirected graph.Functions and pseudocodeBegin Function connections() is a recursive function to find out the connections: A) Mark the current node un visited. B) Initialize time and low value C) Go through all vertices adjacent to this D) Check if the subtree ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
755 Views
Weakly or Strongly Connected for a given a undirected graph can be found out using DFS. This is a C++ program of this problem.Functions usedBegin Function fillorder() = fill stack with all the vertices. a) Mark the current node as visited and print it b) Recur for all the vertices adjacent to this vertex c) All vertices reachable from v are processed by now, push v to Stack End Begin Function DFS() : a) Mark the current node as visited and print it b) Recur for all the vertices adjacent to this vertex EndExample#include ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
541 Views
Weakly or Strongly Connected for a given a directed graph can be found out using DFS. This is a C++ program of this problem.Functions usedBegin Function fillorder() = fill stack with all the vertices. a) Mark the current node as visited and print it b) Recur for all the vertices adjacent to this vertex c) All vertices reachable from v are processed by now, push v to Stack End Begin Function DFS() : a) Mark the current node as visited and print it b) Recur for all the vertices adjacent to this vertex EndExample#include ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
2K+ Views
A Hamiltonian cycle is a Hamiltonian Path such that there is an edge (in graph) from the last vertex to the first vertex of the Hamiltonian Path. It is in an undirected graph is a path that visits each vertex of the graph exactly once.Functions and purposesBegin 1. function isSafe() is used to check for whether it is adjacent to the previously added vertex and already not added. 2. function hamiltonianCycle() solves the hamiltonian problem. 3. function hamCycle() uses hamiltonianCycle() to solve the hamiltonian problem. It returns false if there is no Hamiltonian Cycle ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
156 Views
In this Program we will basically find a feedback arc set which contains edges which when removed from the graph, graph becomes directed acyclic graph.AlgorithmBegin function checkCG(int n) : n: number of vertices. arr: struct graph variable. Initialize cnt = 0 and size = (n-1). For i =0 to n-1 if (cnt == size) return 0 if (arr[i].ptr == NULL) Increase cnt. for j = 0 to n-1 while (arr[j].ptr != NULL) if ((arr[j].ptr)->des == (arr[i].ptr)->des) ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
278 Views
In this program we need to find the Edge Connectivity of a Graph. An Edge Connectivity of a Graph of a graph means it is a bridge, removing it graph will be disconnected. Number of connected components increases with the removing of bridge in a disconnected undirected graph.Functions and pseudocodeBegin Function connections() is a recursive function to find out the connections: A) Mark the current node un visited. B) Initialize time and low value C) Go through all vertices adjacent to this D) Check if the subtree rooted with x has a connection to one ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
225 Views
A Hamiltonian cycle is a Hamiltonian Path such that there is an edge (in graph) from the last vertex to the first vertex of the Hamiltonian Path. It is in an undirected graph is a path that visits each vertex of the graph exactly once.Functions and purposesBegin 1. function isSafe() is used to check for whether it is adjacent to the previously added vertex and already not added. 2. function hamiltonianCycle() solves the hamiltonian problem. 3. function hamCycle() uses hamiltonianCycle() to solve the hamiltonian problem. It returns false if there is no Hamiltonian Cycle possible, ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
100 Views
In this program a random graph is generated for random vertices and edges. The time complexity of this program is O(v*e). Where v is the number of vertices and e is the number of edges.AlgorithmBegin Develop a function GenRandomGraphs(), with ‘e’ as the number of edges and ‘v’ as the number of vertexes, in the argument list. Assign random values to the number of vertex and edges of the graph, Using rand() function. Print the connections of each vertex, irrespective of the direction. Print “Isolated vertex” for the vertex having no ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
207 Views
This is a C++ Program to Generate N Number of Passwords of Length M Each.AlgorithmBegin Take the length of password as input. function permutation() generate random passwords: /* Arguments A pointer array a. Total Number of random numbers m. Length of the password s. */ // Body of the function: if (m == s) for i = 0 to s-1 Print *(a + i) else for i = m to s-1 ... Read More