Category Archives: C++ Programs

Given two numbers represented by two linked lists, write a function that returns the sum list. The sum list is linked list representation of the… Read More
Given an array of n non-negative integers. The task is to find frequency of a particular element in the arbitrary range of array[]. The range… Read More
Given a linked list, print reverse of it using a recursive function. For example, if the given linked list is 1->2->3->4, then output should be… Read More
Given an array of numbers, arrange them in a way that yields the largest value. For example, if the given numbers are {54, 546, 548,… Read More
Algorithm For C++:Iterate through the linked list and delete all the nodes one by one. The main point here is not to access the next… Read More
Given a square matrix, turn it by 90 degrees in anti-clockwise direction without using any extra space.Examples :   Input: Matrix: 1 2 3 4 5… Read More
Given n numbers (both +ve and -ve), arranged in a circle, find the maximum sum of consecutive numbers.  Examples:  Input: a[] = {8, -8, 9,… Read More
Given singly linked list with every node having an additional “arbitrary” pointer that currently points to NULL. We need to make the “arbitrary” pointer to… Read More
Given a Linked List and a number n, write a function that returns the value at the n’th node from the end of the Linked… Read More
Given an array, only rotation operation is allowed on array. We can rotate the array as many times as we want. Return the maximum possible… Read More
Given a sorted array of n distinct integers where each integer is in the range from 0 to m-1 and m > n. Find the… Read More
Number is represented in linked list such that each digit corresponds to a node in linked list. Add 1 to it. For example 1999 is… Read More
Given an array, print the Next Greater Element (NGE) for every element. The Next greater Element for an element x is the first greater element… Read More
Given two lists sorted in increasing order, create and return a new list representing the intersection of the two lists. The new list should be… Read More
Given a singly linked list, find the middle of the linked list. For example, if the given linked list is 1->2->3->4->5 then the output should… Read More