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

2K+ Views
In the Bucket Sorting technique, the data items are distributed of a set of buckets. Each bucket can hold similar type of data. After distributing, each bucket is sorted using another sorting algorithm. After that all elements are gathered into the main list to get the sorted form.The complexity of Bucket Sort TechniqueTime Complexity: O(n + k) for best case and average case and O(n2 ) for worst case.Space Complexity: O(nk) for worst caseInput − A list of unsorted data: 0.25 0.36 0.58 0.41 0.29 0.22 0.45 0.79 0.01 0.69 Output − Array after Sorting: 0.01 0.22 0.25 0.29 0.36 ... Read More

4K+ Views
The radix sort is a non-comparative sorting algorithm that sorts the individual digits of the given numbers in the list. It sorts the numbers digit by digit, starting from the least significant digit to the most significant digit. The radix sort assumes that all the input elements are k-digit numbers. So, if the elements do not have the same number of digits, find the maximum number of digits in an input element and prepend zeroes to the elements having less number of digits. In this article, we have an unsorted array of integers and our task is to implement the ... Read More

5K+ Views
In this article, we will learn how to calculate Fibonacci numbers efficiently using dynamic programming in C++. The Fibonacci sequence starts with 0 and 1, and each next number is the sum of the two preceding ones. The basic recursive method works but becomes very slow for larger numbers because it repeats the same calculations many times. Dynamic programming solves this by storing the results of previous calculations, which makes the process much faster and more efficient. For example, if we want to find the 6th Fibonacci number, the sequence will look like this: F(0) = 0 ... Read More

4K+ Views
To convert fahrenheit to celsius, use a simple mathematical formula. In this article, we are going to discuss the conversion formula, a simple example, and an easy example code. We have been given a temperature in fahrenheit and our task is to convert the given temperature into celsius using C++. Understanding Fahrenheit to Celsius Formula The formula for converting the given temperature from fahrenheit to celsius is as follows: celsius = (fahrenheit - 32.0) * 5.0 / 9.0; Let's see an example to convert the temperature given in fahrenheit to celsius using the above formula: Input: Temperature in ... Read More

4K+ Views
Random numbers are the numbers that are unpredictable and we do not use any pattern or algorithm for choosing them. They are used to bring randomness such as while shuffling data or used in games. To generate a random number in C++, the built-in functions from different libraries such as or can be used. In this article, we will understand four different approaches for generating a random number. The approaches are listed below. Using rand() with srand() Functions Using rand() with Range Limit Using random_device ... Read More

337 Views
In this article we will see how to fill the whole memory by writing a simple C++ program. Here the logic is very simple. We shall create new integer variables by using the dynamic memory allocation. If we create some variables again and again, it will fill the entire primary memory.In C++ to dynamically allocate a memory space we can use the new keyword.The basic syntax of the new operator is like below.pointer_var = new data_typeTo deallocate the memory space, we can use the delete keyword. The syntax isdelete pointer_varNote After running this program it may slow down the performance ... Read More

3K+ Views
We can easily check the Odd or Even by using conditional statements. We can divide the number by 2, then check whether the remainder is 0 or not. If 0, then it is even. We can also perform the AND operation with the number and 1. If the answer is 0, then it is even; otherwise odd. There is no need to use conditional statements in both approaches. We will see two different methods to check the odd or even. Using Modulo Operator The Modulo Operator performs the division operation ... Read More

15K+ Views
Operator overloading in C++ is the feature that allows you to define how operators will behave for user-defined data types like classes and structures. Operator overloading and function overloading both support compile-time polymorphism. In the following article, we will learn the rules that need to be followed for operator overloading. Rules for Operator Overloading Only built-in operators can be overloaded. If some operators are not present in C++, we cannot overload them. The arity of the operators cannot be changed. The precedence and associativity of the operators ... Read More

97 Views
The C++ function std::unordered_multimap::operator=() assigns new contents to the unordered_multimap by replacing old ones and modifies size if necessary.Following is the declaration for std::unordered_multimap::operator=() function form std::unordered_map() header.C++11 (Syntax)unordered_multimap& operator=(const unordered_multimap& umm);Parametersumm - Another unordered_multimap object of same type.Return ValueReturns this pointer.Example Code#include #include using namespace std; int main(void) { unordered_multimap umm1 = { {'a', 1}, {'b', 2}, {'c', 3}, {'d', 4}, {'e', 5}, }; unordered_multimap umm2; umm2 = umm1; cout