
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++

279 Views
In this problem, we are given three numbers N, K and R. Our task is to create a program to find the Sum of the natural numbers (up to N) whose modulo with K yield R.We will add all the numbers less than N that satisfy the following condition, i%K == R.Let’s take an example to understand the problem, Input N = 14, K = 4, R = 1Output 28Explanation − All the numbers less than N, that given 1 as remainder when divided by 4 are 1, 5, 9, 13.To solve this problem, we will loop from R to N, and ... Read More

354 Views
In this problem, we have given three integers M1, M2, and N. Our task is to create a program to find the sum of multiples of two numbers below N.Here, we will add all the elements below N which are multiples of either M1 or M2Let’s take an example to understand the problem, Input N = 13, M1 = 4, M2 = 6Output 20Explanation − Number that are multiples of 4 and 6 that are less than 13 are 4, 6, 8, 12.A simple solution to the problem is to be looping from 1 to N and adding all values that can ... Read More

222 Views
In this problem, we are given a complete binary tree. Our task is to create a program to find the sum of the mirror image nodes of a complete binary tree in an inorder way.Here, we have to find the inorder traversal of the left sun-tree, and then for each node, we will add the mirror image with it. This means if we are traversing the left leaf node, we will add the value of the right leaf node with it. As it is the mirror image node.Some important definitionsComplete binary tree is a binary tree where all levels have ... Read More

420 Views
In this problem, we are given an array arr of N numbers where arr[i] represents (i+1)th node. Also, there are M pairs of edges where u and v represent the node connected by the edge. Our task is to create a program to find the sum of the minimum elements in all connected components of an undirected graph. If a node has no connectivity to any other node, count it as a component with one node.Let’s take an example to understand the problem, Input arr[] = {2, 7, 5, 1, 2} m = 2 1 2 4 5Output 8Explanation Below is the graph ... Read More

426 Views
In this problem, we are given two numbers L and R. We also have an array arr[] such that arr[i] = i*(-1)^i. Our task is to create a program to calculate the sum of the element from index L to R in an array when arr[i] = i*(-1)^i.So, we need to find the sum of elements within the range [L, R] of the array.Let’s take an example to understand the problem, Input L = 2 , R = 6Output 4Explanation arr[] = {-1, 2, -3, 4, -5, 6} Sum = 2+ (-3) + 4 + (-5) + 6 = 4A simple solution to ... Read More

192 Views
In this problem, we are given a number N. Our task is to create a program to find the sum of the digits of the number N in bases from 2 to N/2.So, we have to convert the base of the number to all bases from 2 to N/2 i.e. for n = 9, bases will be 2, 3, 4. And the find the sum of all digits in these bases.Let’s take an example to understand the problem, Input N = 5Output 2Explanation base from 2 to N/2 is 2. 52 = 101, sum of digits is 2.To, solve this problem, we take ... Read More

569 Views
In this problem, we are given a linked list. Our task is to print the sum of alternate nodes of the linked list.Linked list is a sequence of data structure which are connected together via links.Now, let’s get back to the problem. Here, we will add alternate nodes of the linked list. This means we will add nodes are positions 0, 2, 4, 6, …Let’s take an example to understand the problem, Input 4 → 12 → 10 → 76 → 9 → 26 → 1Output 24Explanation considering alternate strings − 4 + 10 + 9 + 1 = 24To solve this problem, ... Read More

1K+ Views
In this problem, we are given an array of string str[]. Our task is to find the score of all strings in the array. The score is defined as the product of the position of the string with the sum of the alphabetical values of the characters of the string.Let’s take an example to understand the problem, Input str[] = {“Learn”, “programming”, “tutorials”, “point” }Explanation Position of “Learn” − 1 →sum = 12 + 5 + 1 + 18 + 14 = 50. Score = 50Position of “programming” − 2 →sum = 16 + 18 + 15 + 7 + 18 + ... Read More

1K+ Views
Interpolation is a type of estimation technique of unknown value which lies between know values. Interpolation is the process of constructing new data points between the range of a discrete set of know data points.An application or reason to use interpolation is that it might reduce computation costs. When the formula (function) to calculate certain values is too complicated or costly to compute, we prefer using interpolation. A few data points are calculated using the original function, the rest of them can be estimated using interpolation. These may not be completely accurate but fairly close!So basically here the reduced computation ... Read More

273 Views
Here, we are given a number N. Our task is to find unorder permutation of N using Alexander Bogomolny’s UnOrdered Permutation Algorithm.Let’s discuss permutation first, A permutation is the number of ways an item in a set can be uniquely ordered is called a permutation.Example − Permutation of {4, 9, 2} would be {4, 9, 2}, {4, 2, 9}, {9, 4, 2}, {9, 2, 4}, {2, 4, 9} and {2, 9, 4}.Permutations have found usage in defining switching networks in computer networking, parallel processing and also used in a variety of cryptographic algorithms.Alexander Bogomolny's Unordered Permutation AlgorithmThis algorithm computes all ... Read More