- 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 7346 Articles for C++
84 Views
What are Corner digits? The corner digits of a number refer to the rightmost and the leftmost digits. For example, the corner digits of 1234 are 1 and 4. The corner digits of a single-digit number will be the number twice. For example, the corner digits of 2 will be 2 and 2. Problem Statement For given two numbers, n, and x, form a number using the corner digits of all the powers of n from 1 and x, i.e., n1, n2....nx. Examples Input: n = 2, x = 4 Output: 22448816 Explanation 21 = 2. Corner digits = ... Read More
987 Views
Gray code or reflected binary code is a form of a binary representation of numbers in which two consecutive numbers only differ by one bit. For example, the gray code of 1 is 001, while the gray code of 2 is 011. Gray code is usually used in error correction because it prevents some data errors that can happen in the usual binary representations while state changes. Gray code is also helpful in k-maps, communication, etc., because of its unique property. Prerequisite Study decimal, binary and gray code notations before reading further. Problem Statement 1 Given a decimal number n, ... Read More
195 Views
Cube-free numbers are those numbers that have no cubic divisors. A cubic divisor refers to an integer that is a cube and divides the number with zero remainders. For example, 8 is a cubic divisor of 16 since 8 is a cube of 2 (2*2*2 = 8), and 8 divides 16 with the remainder of zero. Thus, 8 and 16 both are not cube-free numbers. Problem Statement Find all the cube-free numbers less than a given number, n. Example Let's understand the problem with an example. Let n = 15, Thus, we have to find all the numbers less than ... Read More
211 Views
A Square Pyramidal Number means the Sum of the Square of Natural Numbers. Natural Numbers include all the numbers from 1 to infinity. For example, the first 4 Square pyramidal numbers are 1, 5, 14, 30. For better perception, consider the fact: If we take spheres of numbers equal to the square pyramidal numbers, starting from one, and stack them in descending order, they create a pyramid. Problem Statement Given a number Sum. If Sum is the sum of the squares of first “n” natural numbers, return n, otherwise return false. Example 1 Input = 30 Output = 4 ... Read More
676 Views
Structures in programming languages like C and C++ are a collection of related data fields, which can be accessed and manipulated as a single entity. They are often used to group related data items into a single variable, making it easier to manage and work with complex data structures. However, as code bases grow and evolve over time, it is not uncommon for structures and their members to become unused or redundant. These unused structures and members can clutter code and make it more difficult to understand, maintain, and update. In this article, we will discuss some ways to locate ... Read More
2K+ Views
Introduction The corrupt stack problem is a common issue that programmers encounter while developing software in C and C++ programming languages. This problem can arise due to a wide range of reasons and can cause severe problems in functioning of program. In this article, we will explore corrupt stack problem in detail and look at some examples of how it occurs. What is a Stack in C and C++? Before we discuss corrupt stack problem, we need to understand what a stack is. In C and C++, a stack is a data structure that allows data to be stored and ... Read More
1K+ Views
Introduction Both Queue and Stack are linear data structures and are used to store data. Stack uses the LIFO principle to insert and delete its elements. A Queue uses the FIFO principle. In this tutorial, we will learn how to reverse a stack using Queue. Reversing means the last element of the Stack comes to first place and so on. What is Stack? The stack in the data structure is inspired by the stack in real life. It uses LIFO (Last In First Out) logic, which means the element that enters last in the Stack will be removed first. In ... Read More
199 Views
Introduction Circular Queue is an improvement over a linear queue and it was introduced to address the memory wastage problem in the linear queue. A circular queue uses the FIFO principle for the insertion and removal of the elements from it. In this tutorial, we will discuss the operations of the circular queue and how to manage it. What is Circular Queue? A circular queue is another kind of queue in a data structure, whose front and rear ends are connected with each other. It is also known as Circular Buffer. Its operations are similar to the linear queue, so ... Read More
1K+ Views
Introduction The Priority Queue in C++ is not similar to the normal Queue in the data structure, it has one difference: all its elements have priorities. We can extract its elements by traversing in the Queue. But, here in this tutorial, we are trying a method for extracting the last element of the Priority Queue without traversing. Let’s start… What is Priority Queue? In data structure, the abstract data type is the priority queue. It is a queue where all its elements have some associated priorities. All its elements are removed based on their priorities. Higher priority data are ... Read More
624 Views
Queue is a collection of different data types and is an important part of data structure, following a particular order to insert and remove elements. In this tutorial, we will understand the basic operations of the queue. What is Queue in Data Structure? A Queue is a linear data structure that resembles a queue in real life. You all have been part of some queue in school, the billing counter, or any other place, where the one entered first will exit first in the queue. Similarly, a queue in data structure also follows the FIFO principle, which defines First In ... Read More