Server Side Programming Articles

Page 2104 of 2109

C++ Program to Check whether Graph is a Bipartite using 2 Color Algorithm

Arjun Thakur
Arjun Thakur
Updated on 30-Jul-2019 351 Views

A bipartite graph is a graph in which if the graph coloring is possible using two colors i.e.; vertices in a set are colored with the same color. This is a C++ program to Check whether a graph bipartite or not using 2 color algorithm.Functions and pseudocodesBegin    1. Develop function isSafe() to check if the current color assignment       is safe for vertex v, i.e. checks whether the edge exists or not.       If it exists, then next check whether the color to be filled in       the new vertex is already used ...

Read More

C++ Program to Implement Gauss Jordan Elimination

Anvi Jain
Anvi Jain
Updated on 30-Jul-2019 6K+ Views

This is a C++ Program to Implement Gauss Jordan Elimination. It is used to analyze linear system of simultaneous equations. It is mainly focused on reducing the system of equations to a diagonal matrix form by row operations such that the solution is obtained directly.AlgorithmBegin    n = size of the input matrix    To find the elements of the diagonal matrix:    Make nested for loops j = 0 to n and i = 0 to n       The element in the first row and the first column is made 1       and then the ...

Read More

Why C++ does not have a virtual constructor?

Smita Kapse
Smita Kapse
Updated on 30-Jul-2019 4K+ Views

The virtual mechanism works only when we have a base class pointer to a derived class object.In C++, constructor cannot be virtual, because when constructor of a class is executed there is no virtual table in the memory, means no virtual pointer defined yet. So, the constructor should always be non-virtual.But virtual destructor is possible. Here is an exampleExample#include using namespace std; class b {    public:    b()    { cout

Read More

C++ Program to Generate Randomized Sequence of Given Range of Numbers

Smita Kapse
Smita Kapse
Updated on 30-Jul-2019 609 Views

At first let us discuss about the rand() function. rand() function is a predefined method of C++. It is declared in header file. rand() is used to generate random number within a range. Here min_n is the minimum range of the random numbers and max_n is the maximum range of the numbers. So rand() will return the random numbers between min_n to (max_n – 1) inclusive of the limit values. Here if we mention lower and upper limits as 1 and 100 respectively, then rand() will return values from 1 to (100 – 1). i.e. from 1 to 99.AlgorithmBegin ...

Read More

C++ Program to Implement Direct Addressing Tables

Anvi Jain
Anvi Jain
Updated on 30-Jul-2019 756 Views

This is a C++ program to implement Direct Addressing Tables. Direct Addressing Tables are used when each element has a key drawn from a universal set S = {0, 1, . . . ,n − 1} where n isn’t too large and each key is unique. It facilitates fast insertion, searching and deletion operations.Functions and pseudocodesBegin    insert():       Take the table variables word and key as argument.       T[ x.key ] = x, where x is a value of key.    delete():       Take the table variables word and key as argument.   ...

Read More

C++ Program to Check if an UnDirected Graph is a Tree or Not Using DFS

George John
George John
Updated on 30-Jul-2019 309 Views

A graph is a tree if it does not contain any cycle. This is a C++ program to check whether an undirected graph is tree or not.AlgorithmBegin function cyclicUtil() :    A) Mark the current node as visited.    B) Recur for all the vertices adjacent to this vertex.    C) If an adjacent is not visited, then recur for that adjacent.    D) If an adjacent is visited and not parent of current vertex, then there is a cycle. End Begin function cyclic():    A) Mark all the vertices as not visited and not part of recursion stack.   ...

Read More

C++ Program to Find Basis and Dimension of a Matrix

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 305 Views

This is a C++ program to find Basis and Dimension of a Matrix.AlgorithmBegin    Function determinant() :    It calculates determinant of the matrix.    /*       Arguments:       n = number of elements.       matrix[10][10] = input matrix.    */    declare the submatrix submatrix[10][10].    //Body of the function:    if (n == 2)       return ((matrix[0][0] * matrix[1][1]) - (matrix[1][0] * matrix[0][1]))    else       Make a for loop c = 0 to n-1          Declare and initialize submati = 0, submatj.     ...

Read More

C++ Program to Generate Random Hexadecimal Bytes

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 2K+ Views

We shall discuss about a C++ program which can generate random Hexadecimal numbers. Here we shall use rand() and itoa() functions to implement the same. Let us discuss on these functions separately and categorically.rand(): rand() function is a predefined method of C++. It is declared in header file. rand() is used to generate random number within a range. Here min_n is the minimum range of the random numbers and max_n is the maximum range of the numbers. So rand() will return the random numbers between min_n to (max_n – 1) inclusive of the limit values. Here if we mention ...

Read More

C++ Program to Remove the Edges in a Given Cyclic Graph such that its Linear Extension can be Found

George John
George John
Updated on 30-Jul-2019 282 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 ...

Read More

List of C++ IDEs for Linux

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 527 Views

The following are some of C++ IDEs for linux − Eclipse Galileo with CDT Plugin Eclipse is a well-known open source and cross platform IDE. It provides full functional C/C++ IDE with the following features − Code editor with support for syntax highlighting Support for folding and hyperlink navigation Source code refactoring plus code generation Tools for visual debugging such as memory, registers etc. NetBeans IDE NetBeans is free, open source and popular IDE for C/C++. These are some of its features − Support for automatic packaging of compiled application into .tar, .zip and many more archive ...

Read More
Showing 21031–21040 of 21,090 articles
Advertisements