Implement Merge Sort using C++

In this article, you will learn about a sorting algorithm that uses divide and conquer strategy to sort an array. Merge sort first divides an array into equal parts and then combines them after sorting. A C++ Implement of Merge Sort To understand how merge sort works, let’s consider an array called arr[] having a... » read more

Implement Heap Sort using C++

A heap is a tree-based data structure in which the tree is almost a complete binary tree. The maximum number of a child node in a binary heap is at most 2. Implement a Heap Sort Function using C++ In a binary heap, the height of a heap tree is log2N if the heap is... » read more

Implement Bucket Sort using C++

Implement a Bucket Sort method using C++ You can use bucket sort if the input values are distributed uniformly over a given range. Mostly, the bucket sort is used to sort floating-point numbers in the range [0,1] Needless to say, the recursive implementation of the bucket sorting algorithm uses the bucket sorting to sort the... » read more

How to find Factorial of a large number using C++

Factorial of a non-negative number n is expressed as n!. Mathematically, Factorial is defined as: By default, the factorial of zero is defined to be 1. For example, if you have to find the factorial of 5, multiple all positive integers less than or equal to 5. There are a few ways to write the... » read more

Find Factorial of a Number using Recursion in C++

First of all, we need to understand the concept of recursion and factorial to write this program. What is Recursion? It is an essential concept in computer science. In computer science, recursion is a process in which a function calls itself directly or indirectly. Recursion function must have the following two properties: What is Factorial?... » read more

How to Check if a Matrix is Invertible using C++

To write this program, we need to understand the concept of invertible. A matrix (A)n ×n is said to be invertible if and only if there exists another matrix (B)n ×n such that AB=BA=ln. A matrix is invertible if and only if its determinant is not zero. A matrix is singular or not invertible if... » read more

Find Factorial of a Number using Iteration in C++

The following is a program to find a factorial of a number using iteration in C++. To write this program, first of all, we need to understand the concept of factorial. What is Factorial? Factorial is represented by an exclamation mark (!). Factorial of n number is the product of all integers greater than or... » read more

Simulate a ‘N’ Roller Dice using C++

A dice roller grants you to roll a constructive dice. It is used to generate a sequence of random number mainly use in gambling games like Backgammon, sic bo or Yahtzee. A computational device uses to create a series of random symbols or numbers with lack of any pattern. How to simulate a Roller Dice... » read more

An encoding of a message using matrix multiplication in C++

Encoding is performed between a given matrix and key matrix using matrix multiplication. We included header file conio.h to use getch() function which is used to stop the output screen from blinking. Message encoding using matrix multiplication in C++ Below is a C++ program that an encoding of a message using matrix Multiplication. This program... » read more

Perform Matrix Multiplication using C++

Below is a C++ program to perform Matrix Multiplication. This program is successfully compiled, and the output is also given below. Matrix Multiplication in C++ #include<iostream> using namespace std; int main () { int row1, clum1, row2, clum2; int i, j, k; int X[8][8], Y[8][8], Z[8][8]; cout << "Please Enter Rows and Columns Of Mateix... » read more

Implementation of Binary Trees in C++

A binary tree is a data structure with a finite set of nodes consisting of: A unique node with no parents called root and zero or more subtrees. Every node can be connected to an arbitrary number of nodes, called children. Nodes with no children are called external nodes or leaves. Internal nodes are the... » read more

Search an element in Binary Search Tree using C++

The Binary search tree is a data structure consisting of nodes. The nodes are either null or have reference to other (child) nodes. Every node can have up to 2 nodes, called the left node or the right node. Each node will also contain a value, which will determine where these nodes are placed within... » read more

Implementation of Radix Sort in C++

Radix sort is a sorting algorithm that is used to sort numbers. For example, if we are dealing with unsorted numbers, we know that these numbers are formed using digits from 0 to 9. So we need ten places labeled 0 to 9 to unsorted numbers. Radix Sort in C++ So, let’s get started with... » read more