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

265 Views
Suppose we have a linked list, we have to reverse the nodes of the linked list k at a time and return its modified list. Here k is a positive integer and is less than or equal to the length of the linked list. So if the number of nodes is not a multiple of k then left-out nodes, in the end, should remain as it is.So if the linked list is like [1, 2, 3, 4, 5, 6, 7] and k is 3, then the result will be [3, 2, 1, 6, 5, 4, 7].To solve this, we will ... Read More

454 Views
Suppose we have two arrays; these arrays are sorted. So we have to find the median of these two arrays. So if the arrays are like [1,5,8] and [2,3,6,9], then the answer will be 5.To solve this, we will follow these steps −Define a function findMedianSortedArrays, this will take nums1 and nums2 arraysif size of nums1 > size of nums2, then,Call the function return findMedianSortedArrays(nums2, nums1)x := size of nums1, y := size of nums2low := 0, high := xtotalLength := x + ywhile low

314 Views
In this article, we will find the smallest difference in angles between two parts of a given circle using the C++ programming language. Before proceeding to the code, let’s first understand how we can calculate the angles to find the smallest difference between them. We are given the angles of all the pieces of the circle in the array. We have to join the pieces in such a way that the angle difference between the two pieces is the least. Let's go through the input and output scenario for better understanding. Here, we declare an array contianing three different angles ... Read More

4K+ Views
In this problem, we are given string str. Our task is to create a program to find Smallest and Largest Word in a String in C++.Problem Description − Here, we have a string we need to find the word whose length is maximum and minimum out of all words in the string. The word is separated using white spaces or null(\0) characters.Let’s take an example to understand the problemInputstr = “Learn Programming at TutorialsPoint”Outputsmallest word = at largest word = TutorialspointSolution ApproachTo find the smallest and largest word, we will find the length of each word by using two indexes, ... Read More

2K+ Views
In this article, we will learn how to find the Slope of a line using a program. But before we proceed into the program, let's first understand what the Slope of a line represents in mathematics and how to compute it using its mathematics formula in C++. In mathematics, the Slope of a line is a numerical value that measures the line’s steepness and direction. It indicates the rate at which the line ups or down as you move along it from left to right (or horizontally). Generally, it is denoted by the letter "m". In mathematics, the steepness refers to the slope or gradient of a line. In terms of mathematical, ... Read More

604 Views
In this problem, we are given a doubly linked list. Our task is to create a program to find size of Doubly Linked List in C++.Doubly Linked List is a special type of Linked list in which navigation is possible in both ways, either forward and backward easily as compared to Single Linked List. The following are the important terms to understand the concept of doubly linked lists.Link − Each link of a linked list can store a data called an element.Next − Each link of a linked list contains a link to the next link called Next.Prev − Each ... Read More

854 Views
In this problem, we are given string str. Our task is to create a Program to find second most frequent character in C++.Let’s take an example to understand the problemInputstr = “abaacabcba”Output‘b’Solution ApproachTo find the character that is second most frequent in the string. We need to maintain a count array chatCount that is used to store the frequency of each character in the string. And then using the array we will find the character with max and secondMax frequency in the array. And display the second most frequent character.Program to illustrate the working of our solutionExample Live Demo#include #include ... Read More

1K+ Views
In this tutorial, we will be discussing a program to find the root of an equation using secant method.For this we will be provided with an equation. Our task is to find the roots of that equation using the iterative secant method.Example Live Demo#include using namespace std; float f(float x) { float f = pow(x, 3) + x - 1; return f; } void secant(float x1, float x2, float E) { float n = 0, xm, x0, c; if (f(x1) * f(x2) < 0) { do { //calculating the ... Read More

2K+ Views
In this problem, we are given two numbers, N and D. Our task is to create a Program to find remainder without using modulo or % operator in C++.Problem description − We need to find the remainder that will be left after dividing the number N by D. But we cannot use the modulo or % operator for this.Let’s take an example to understand the problemInputN = 53 D = 3Output2Solution ApproachTo find the remainder, a simple approach is to find the number less than N which is the multiple of D. And the substrate the number from N. To ... Read More

523 Views
In this problem, we are given a string num which is a large number and an integer R. Our task is to create a program to find remainder when large number is divided by r in C++.Problem Description − We need to find the remainder when the number defined by the string is divided by r which is a two-digit number.Let’s take an example to understand the problemInputnum = “123423450942121” r = 54Output7Solution ApproachTo find the remainder, we obviously need to divide the number. But dividing huge numbers is a complex process so to ease up the process, we will ... Read More