Inverse of a Matrix: For a square matrix A, the inverse is written A-1. When A is multiplied by A-1 the result is the identity matrix I. Non-square matrices do not have inverses. Note: Not all square matrices have inverses. A square matrix which has an inverse is called invertible or nonsingular, and a square […]

# Category: cpp codes

## C++ Program to generate CAPTCHA and verify user

[ad_1] What is CAPTCHA? A CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) is a test to determine whether the user is human or not. So, the task is to generate unique CAPTCHA every time and to tell whether the user is human or not by asking user to enter the […]

## Method overloading vs Method Overriding

Difference between Method Overloading vs Method overriding: Overloading can occur without inheritance. Overriding of functions occurs when one class is inherited from another class. Overloaded functions must differ in function signature i.e. either number of parameters or type of parameters should differ. In overriding, function signatures must be same. Overloaded functions are in same […]

## Red Black-Tree(RB-Tree) implementation in C++

Red Black-Tree (RB-Tree): A red-black tree is a binary search tree with one extra attribute for each node: the colour, which is either red or black. It has following properties: Every node is either red or black. Every leaf (NULL) is black. If a node is red, then both its children are black. Every simple […]

## Implement function overloading to find Area of Shapes

What is Function Overloading? When we define one function with more than one definition it is known as Function overloading. For example: int shape(int x); int shape(int x, int y); We can have multiple definitions for the same function name in the same scope. The definition of the function must differ from each other by the types […]

## Solution for Tower of Hanoi C++

What is Tower of Hanoi? All must be well aware of the problem of Tower of Hanoi, for those who don’t know, let’s discuss it once again. The Tower of Hanoi (also called the Tower of Brahma or Lucas’ Tower, and sometimes pluralized) is a mathematical game or puzzle. It consists of three rods, […]

## Program to implement Heap C++

Here is the source code of the program to implement heap C++ programming language. #include <iostream> #include <cstdlib> #include <vector> #include <iterator> using namespace std; // Class Declaration class Heap { private: vector <int> heap; int left(int parent); int right(int parent); int parent(int child); void heapifyup(int index); void heapifydown(int index); public: Heap() {} void Insert(int […]

## Program to implement Hash Tables C++

What is Hash Table Program to implement Hash Tables C++ #include<iostream> #include<cstdlib> #include<string> #include<cstdio> using namespace std; const int TABLE_SIZE = 128; /* * HashEntry Class Declaration */ class HashEntry { public: int key; int value; HashEntry(int key, int value) { this->key = key; this->value = value; } }; /* * HashMap Class Declaration */ […]

## C++ Program to Implement Floyd Warshall Algorithm

Floyd–Warshall algorithm is an algorithm for finding shortest paths in a weighted graph with positive or negative edge weights (but with no negative cycles). A single execution of the algorithm will find the lengths (summed weights) of the shortest paths between all pairs of vertices, though it does not return details of the paths themselves. […]

## Shortest Path using Bellman Ford Algorithm

C++ Program to Use the Bellman Ford Algorithm to Find the Shortest Path Between Two Vertices. Assuming that Negative Size Edges Exist in the Graph Here is source code of the C++ Program to Use the Bellman Ford Algorithm to Find the Shortest Path Between Two Vertices Assuming that Negative Size Edges existing the Graph. […]