Skip to content

Category Archives: C++ Programs

Bit Rotation: A rotation (or circular shift) is an operation similar to shift except that the bits that fall off at one end are put… Read More
Given an array A[] consisting 0s, 1s and 2s. The task is to write a function that sorts the given array. The functions should put… Read More
Given two integer arrays arr1[] and arr2[] sorted in ascending order and an integer k. Find k pairs with smallest sums such that one element… Read More
Given a sorted linked list, delete all nodes that have duplicate numbers (all occurrences), leaving only numbers that appear once in the original list. Examples: Input:… Read More
Given a string of size n, write functions to perform the following operations on a string- Left (Or anticlockwise) rotate the given string by d… Read More
Given a linked list, write a function to reverse every alternate k nodes (where k is an input to the function) in an efficient way.… Read More
In C++ input and output are performed in the form of a sequence of bytes or more commonly known as streams. cerr and clog both… Read More
Given a 2D array, print it in reverse spiral form. We have already discussed Print a given matrix in spiral form. This article discusses how… Read More
An array in C/C++ or be it in any programming language is a collection of similar data items stored at contiguous memory locations and elements… Read More
Member Function: It is a function that can be declared as members of a class. It is usually declared inside the class definition and works… Read More
Given a singly linked list, write a function to swap elements pairwise. For example, if the linked list is 1->2->3->4->5->6->7 then the function should change… Read More
Given an array of positive and negative numbers, find if there is a subarray (of size at-least one) with 0 sum. Examples :  Input: {4,… Read More
Switch case statements are a substitute for long if statements that compare a variable to several integral values. The switch statement is a multiway branch… Read More
Given an array arr[ ] of size N and an integer p, the task is to find maximum possible value of rightmost element of array… Read More
Given three variables that represent the hours, minutes, and the second, the task is to write a C++ program to normalize/convert the given time into… Read More

Start Your Coding Journey Now!