
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 7197 Articles for C++

3K+ Views
Heap Sort is based on the binary heap data structure. In the binary heap the child nodes of a parent node are smaller than or equal to it in the case of a max heap, and the child nodes of a parent node are greater than or equal to it in the case of a min heap.An example that explains all the steps in Heap Sort is as follows.The original array with 10 elements before sorting is −207154101590237725This array is built into a binary max heap using max-heapify. This max heap represented as an array is given as follows.907720542515123710The root ... Read More

5K+ Views
A binary tree is a tree data structure where each node has zero, one, or two children. Even an empty tree is called a valid binary tree. Our goal is to write a C++ program to perform postorder recursive traversal on a given binary tree. Traversal means visiting all the nodes in a tree exactly once. In postorder traversal, we visit the left child (left subtree) first, then the right child (right subtree), and finally the root node. Let's take a small binary tree and look at an example. Here, we first ... Read More

15K+ Views
Tree traversal is a form of graph traversal. It involves checking or printing each node in the tree exactly once. The inorder traversal of a binary tree involves visiting each of the nodes in the tree in the order (Left, Root, Right). An example of Inorder traversal of a binary tree is as follows. Here, we start at the leftmost node(5), move up to 6, then to 2, then to root 3, and continue to the right side with 9 then 4 and 8. Using Recursion for Inorder Traversal Recursion is a technique where a function ... Read More

8K+ Views
In this article, we'll show you how to write a C++ program to perform a preorder recursive traversal of a binary tree. A binary tree is a tree where each node has zero, one, or two children. Even an empty tree is called a valid binary tree. Traversal means visiting all the nodes in a tree exactly once. In preorder traversal, we visit the root first, then the left child, and finally the right child. Let's take a small binary tree and see an example: Here, we start at the root(3), then go to the left child (6), ... Read More

387 Views
Two matrices are said to be multiplicable if they can be multiplied. This is only possible when the number of columns of the first matrix is equal to the number of rows of the second matrix. Our goal is to check whether the given matrices are multiplicable or not using C++. Let's understand this with an example: Number of rows in Matrix 1 = 3 Number of columns in Matrix 1 = 2 Number of rows in Matrix 2 = 2 Number of columns in Matrix 2 = 5 Matrix 1 and Matrix 2 are multiplicable because ... Read More

11K+ Views
The determinant of a square matrix can be computed using its element values. The determinant of a matrix A can be denoted as det(A) and it can be called the scaling factor of the linear transformation described by the matrix in geometry. An example of the determinant of a matrix is as follows. The matrix is: 3 1 2 7 The determinant of the above matrix: = 7*3 - 2*1 = 21 - 2 = 19 So, the determinant is 19. Steps to Compute Determinant of a Matrix We find the determinant using a method called recursive Laplace ... Read More

402 Views
A matrix is invertible if it has an inverse. An inverse of a matrix exists only when its determinant is non-zero. If the determinant of a matrix is zero, the matrix is called singular and cannot be inverted. In this article, we'll write a C++ program to check if a matrix is invertible using its determinant. To better understand this, let's take the following 3x3 matrix as an example: Given 3*3 Matrix: 4 2 1 2 1 1 9 3 2 To check if this matrix is invertible, we ... Read More

2K+ Views
A matrix is a rectangular array of numbers that is arranged in the form of rows and columns.An example of a matrix is as follows.A 3*4 matrix has 3 rows and 4 columns as shown below.8 6 3 5 7 1 9 2 5 1 9 8A program that multiplies two matrices by passing the matrices to functions is as follows.Example Live Demo#include using namespace std; void MatrixMultiplication(int a[2][3],int b[3][3]) { int product[10][10], r1=2, c1=3, r2=3, c2=3, i, j, k; if (c1 != r2) { cout

8K+ Views
A structure is a collection of items of different data types. It is very useful in creating complex data structures with different data type records. A structure is defined with the struct keyword. In this article, we will store and display information of an employee using a structure. An example of a structure is as follows: struct employee { int empID; char name[50]; int salary; char department[50]; }; Store Information in Structure and Display It In this program, we store and display employee information using a ... Read More

8K+ Views
Standard deviation is a measure of how spread out the numbers in a dataset are. It is the square root of the variance, where variance is the average of the squared differences from the mean. In this article, we will show you how to calculate the standard deviation in C++. Let's understand this with an example: Input: Numbers are 4, 8, 6, 5, 8 Calculating: Find the mean = (4 + 8 + 6 + 5 + 8) / 5 = 31 / 5 = 6.2 Subtract the mean and square the result: (4 - 6.2)^2 = ... Read More