# Category Archives: C++ Programs

New programmers are usually in the search of ways to return multiple values from a function. Unfortunately, C and C++ do not allow this directly.… Read More
list in STL is used to represent a linked list in C++. How to create a nested list. We are given n lists, we need… Read More
Given a number N which represents the number of rows. The task is to print a half diamond Number-Star pattern as shown in the below… Read More
Prerequisite: Symbol Table A Symbol table is a data structure used by the compiler, where each identifier in program’s source code is stored along with… Read More
Given four points (x, y) in the cartesian coordinate. Find the possible no of quadrilaterals than can be formed by joining all the four points. Examples:  … Read More
Given a number N. The task is to write a program to find the N-th term in the below series:  a, b, b, c, c,… Read More
Given three strings(without spaces). The task is to print the new string after modifying the three given string as follows:   Replace all the vowels present… Read More
Below are the steps for finding MST using Kruskal’s algorithm   1. Sort all the edges in non-decreasing order of their weight. 2. Pick the smallest edge.… Read More
We have discussed Prim’s algorithm and its implementation for adjacency matrix representation of graphs. As discussed in the previous post, in Prim’s algorithm, two sets are… Read More
Given a dice with m-faces. The first face of the dice contains a dot, the second one contains two dots, and so on, the m-th… Read More
Given a number N. The task is to write a program to find the N-th term in the below series:   0, 0, 2, 1, 4,… Read More
Given two numbers a and b. The task is to subtract b from a by using 2’s Complement method.Note: Negative numbers represented as 2’s Complement… Read More
Given a number N. The task is to write a program to find the N-th term in the below series:  1, 1, 2, 3, 4,… Read More
What do you think happens when you use an uninitialized primitive data type? Well you may assume that the compiler should assign your primitive type variable… Read More
You are given Q queries. Each query contains an integer k and a person’s information i.e, first name, last name, age. For each query, we… Read More