- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 7347 Articles for C++
![Prateek Jangid](https://www.tutorialspoint.com/assets/profiles/399467/profile/60_2793348-1637657587.jpeg)
122 Views
Discuss a problem based on expanding the matrix. Expanding matrix is a matrix whose size continuously increases by some factor.Here we have a matrix of characters whose size is expanding by a factor of 2, i.e., if the original size of the matrix is N * N, then the size of the expanded matrix becomes 2N * 2N. We are given a sequence of characters present at ( i, j ), and we need to return the sequence of characters present at (i, (j - N - 1)%N).Let’s understand by visualizing some initial expanded matrix, Given Matrix -> [ a, ... Read More
![Prateek Jangid](https://www.tutorialspoint.com/assets/profiles/399467/profile/60_2793348-1637657587.jpeg)
1K+ Views
Discuss dividing an unsigned integer using a division algorithm. Some division algorithms are applied on paper, and others are implemented on digital circuits. Division algorithms are of two types: slow division algorithm and fast division algorithm. Slow division algorithm includes restoring, non-performing restoring, SRT, and non-restoring algorithm.In this tutorial, we will discuss the Restoring algorithm, assuming that 0 < divisor < dividend.Approach to Find the SolutionIn this, we will use register Q to store quotient, register A to store remainder, and M to store divisor. The initial value of A is kept at 0, and its value is restored, which ... Read More
![Prateek Jangid](https://www.tutorialspoint.com/assets/profiles/399467/profile/60_2793348-1637657587.jpeg)
281 Views
In this article, we have an array containing distinct elements. We need to print the pairs of positive-negative values in the array with the same absolute value and print them in sorted order for examples −Input : arr[] = { 1, -1, 11, 12, 56, 77, -56, -12, -88} Output : -1 1 -12 12 -56 56 Input : arr[] = {30, 40, 50, 77, -51, -50, -40} Output : -40 40 -50 50Approach to find The SolutionThe first approach that comes to our mind is the Brute Force approach, and we make up another one called the Efficient ... Read More
![Prateek Jangid](https://www.tutorialspoint.com/assets/profiles/399467/profile/60_2793348-1637657587.jpeg)
175 Views
In this article, we will discuss finding a pair with a maximum sum in a given matrix or 2-D array. For exampleInput : matrix[m][n] = { { 3, 5, 2 }, { 2, 6, 47 }, { 1, 64, 66 } } Output : 130 Explanation : maximum sum is 130 from element pair 64 and 66. Input : matrix[m][n] = { { 55, 22, 46 }, { 6, 2, 1 }, { 3, 24, 52 } } Output : 107 Explanation : maximum sum is 130 from element pair 55 and ... Read More
![Prateek Jangid](https://www.tutorialspoint.com/assets/profiles/399467/profile/60_2793348-1637657587.jpeg)
191 Views
In this article, we will discuss the program of finding a pair with a given sum in a given matrix. For example −Input : matrix[n][m] = { { 4, 6, 4, 65 }, { 56, 1, 12, 32 }, { 4, 5, 6, 44 }, { 13, 9, 11, 25 } }, SUM = 20 Output : Pair exists. Explanation : Sum = 20 is equal to the sum of numbers 9 and 11 which exists in the matrix. Input : matrix[n][m] = { { 5, 7, 3, 45 ... Read More
![Prateek Jangid](https://www.tutorialspoint.com/assets/profiles/399467/profile/60_2793348-1637657587.jpeg)
176 Views
Discuss the problem of representing a number in the power of another number. We are given two numbers, x, and y. We need to tell whether y can be represented in the power of x where each power of x can be used once, for exampleInput: x = 4, y = 11 Output: true Explanation: 4^2 - 4^1 - 4^0 = 11 Hence y can be represented in the power of x. Input: x = 2, y = 19 Output: true Explanation: 2^4 + 2^1 + 2^0 =19 Hence y can be represented in the power of x. ... Read More
![Prateek Jangid](https://www.tutorialspoint.com/assets/profiles/399467/profile/60_2793348-1637657587.jpeg)
406 Views
This tutorial will discuss the representation of a number as a sum of minimum pseudo-binary numbers. Pseudo-binary numbers are the numbers that consist of only binary digits, i.e., 0 and 1. Examples of pseudo-binary numbers are 00, 11, 10, 100, 111, 1011, etc.Below are some examples of numbers represented as the sum of pseudo-binary numbers.Input : 23 Output : 11 + 11 + 1 Explanation : 23 = 11 + 11 + 1, sum of pseudo-binary numbers(11, 11, 1) is 23. Input : 50 Output : 10 + 10 + 10 + 10 + 10Approach to Find the SolutionBelow ... Read More
![Prateek Jangid](https://www.tutorialspoint.com/assets/profiles/399467/profile/60_2793348-1637657587.jpeg)
175 Views
Discuss a problem where we are given a number N, and we need to split this number in the maximum prime numbers sum, for exampleInput: N = 7 Output: 2 2 3 Explanation: 7 can be represented as the sum of two 2’s and a 3 which are the maximum possible prime numbers. Input : N = 17 Output: 2 2 2 2 2 2 2 3Approach to Find the SolutionTo represent a number in prime numbers, we can subtract a prime number with N and check the difference for prime. If the difference is prime, then we can ... Read More
![Prateek Jangid](https://www.tutorialspoint.com/assets/profiles/399467/profile/60_2793348-1637657587.jpeg)
639 Views
In this article, we will discuss the problem to find the numbers from 1 to n(given) which are can not be divided by any number from 2 to 10. Let's understand this with some examples −Input : num = 14 Output : 3 Explanation: There are three numbers, 1, 11, and 13, which are not divisible. Input : num = 21 Output : 5 Explanation: There are five numbers 1, 11, 13, 17, and 19, which are not divisible.Approach to find The SolutionSimple ApproachIf we check every number from 1 to num, whether it can be divided by any ... Read More
![Prateek Jangid](https://www.tutorialspoint.com/assets/profiles/399467/profile/60_2793348-1637657587.jpeg)
337 Views
Discuss How to represent a set of points by the best possible straight line. We are given values (x, y) of a set of points, and we need to find the best straight line y = mx + c, So all we need is to find the value of m and c, for exampleInput: no_of_points = 4 x1 = 2, y1 = 3, x2 = 5, y2 = 6, x3 = 1, y3 = 3, x4 = 4, y4 = 5. Output: m = 0.8, c = 1.85 Explanation: If we apply the value of m and c in ... Read More