Posts from C++

C++ program to convert an array into Zig-Zag fashion

By Abinash Reddy

In this article, we will learn how to convert an array into zig-zag fashion in C++. Let’s consider an array arr with elements {a, b, c, d, e, f, g} the array is said to bein .... Read More

Middle of three numbers using minimum comparisons in C++

By Tanichha Bal

This tutorial helps you to learn how to find the middle of three numbers using minimum comparison in C++. The program mainly consists of 2 parts To compare and arrange the number i.... Read More

abort() function in C++

By Punnam Chandnaik

In this tutorial, we are going to learn the abort() function using C++. Syntax of abort function in C++ void abort (void); abort() function will not close the file that is open. It.... Read More

Arithmetic expression evaluation program in C++

By Punnam Chandnaik

In this tutorial, we will learn the program for arithmetic expression evaluation in C++ with some cool and easy examples. In many situations, you might have to come up with this ty.... Read More

Implement Johnson’s algorithm for All-pairs in C++

By Punnam Chandnaik

In this tutorial, we will learn to Implement Johnson’s algorithm for All-pairs the shortest paths in C++. At final, we will implement code. Johnson’s algorithm for All-pairs th.... Read More

How to Find Sum of Nodes in a Binary Tree in C++

By Abinash Reddy

In this article, we will learn how to find the sum of nodes in a binary tree in C++. Example Input:         8 / \ 7 6 / \ / \ 5 4 3 2 Output: 35 Exaplnation: 8+7+6+5+4+3+2 = 35.... Read More

Find whether n! is divisible by sum of first n natural integers or not in C++

By Vikram singhal

Given an integer value n. Product of first n natural integers or n! (factorial of n )is denoted by P  and the sum of first n consecutive natural integers is denoted by S. If S is .... Read More

Implementation of Egyptian Fraction using Greedy Algorithm in C++

By Abinash Reddy

In this article, we will learn how to implement Egyptian Fraction using a Greedy Algorithm in C++. A positive fraction number can be represented as the sum of unique unit fractions.... Read More