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

3K+ Views
A bidirectional search is a searching technique that runs two way. It works with two who searches that run simultaneously, first one from source too goal and the other one from goal to source in a backward direction. In in an optimal state, both the searches will meet in the middle off the data structure.The bidirectional search algorithm works on a directed graph to find the shortest path between the source(initial node) to the goal node. The two searches will start from their respective places and the algorithm stops when the two searches meet at a node.Importance of the bidirectional ... Read More

296 Views
The iterators that have the privilege to access the sequence of elements of a range from both the directions that are from the end and from the beginning are known as bidirectional iterators. iterators can work on data types like list map and sets.Bidirectional iterators have the same properties as forwarding iterators, with the only difference that they can also be decremented −propertyvalid expressionsIs default-constructible, copy-constructible, copy-assignable and destructibleX a;X b(a);b = a;Can be compared for equivalence using the equality/inequality operators (meaningful when both iterator values iterate over the same underlying sequence).a == ba != bCan be dereferenced as an ... Read More

1K+ Views
An integer is called an Armstrong number of order n if it's every digit separate out and cubed and summed up then the sum will be same as the number i.e. abcd... = a3 + b3 + c3 + d3 + ...In case of an Armstrong number of 3 digits, the sum of cubes of each digit is equal to the number itself. For example:153 = 13 + 53 + 33 // 153 is an Armstrong number.Input: Enter two numbers(intervals):999 9999 Output: Armstrong numbers between 999 and 9999 are: 1634 8208 9474Explanation1634 = 13+63+33+43 = 1+216+27+64 = 1634The approach implemented ... Read More

2K+ Views
Quick sort algorithm is also known as partition exchange sort and is based on partitioning of an array of data into smaller sub-arrays. A large array is partitioned into two arrays such that the left sub-array holds values smaller than the pivot element and the right sub-array holds values greater than the pivot value. Quicksort partitions an array and then calls itself recursively twice to sort the two resulting sub-arrays: left and right sub-arrays. Quick sort falls uses the divide and conquer approach of problem-solving methodology. This algorithm is ... Read More

603 Views
Pigeonhole Sort is an example of the non-comparison sorting technique. It is used where the number of items and the range of possible key values is approximately the same.To perform this sort, we need to make some holes. The number of holes needed is decided by the range of numbers. In each hole, items are inserted. Finally deleted from the hole and stored into an array for sorted order.Pigeonhole sorting, also known as count sort, is a sorting algorithm that is suitable for sorting lists of elements where the number of elements (n) and the number of possible key values ... Read More

3K+ Views
Vector is a template class and is C++ only construct whereas arrays are built-in language construct and present in both C and C++.Vector are implemented as dynamic arrays with list interface whereas arrays can be implemented as statically or dynamically with primitive data type interface.Differences between a Vector and an ArrayA vector is a dynamic array, whose size can be increased, whereas THE array size can not be changed.Reserve space can be given for vector, whereas for arrays you cannot give reserved space.A vector is a class whereas an array is a datatype.Vectors can store any type of objects, whereas ... Read More

184 Views
Array multiplication we will find the product of all elements of the given array. and then according to the problem, we will divide the product with the number n. let's take an example −Input: arr[] = { 12, 35, 69, 74, 165, 54}; N = 47 Output: 14ExplanationThe array is like {12, 35, 69, 74, 165, 54} so the multiplication will be (12 * 35 * 69 * 74 * 165 * 54) = 19107673200. Now if we want to get the remainder after dividing this by 47 it will be 14.First multiple all the number then ... Read More

611 Views
The unique prime factors is a factor of the number that is a prime number too. In this problem, we have to find the product of all unique prime factors of a number. A prime number is a number that has only two factors, the number and one.Here we will try to find the best way to calculate the product of unique prime factors of a number. let's take an example to make the problem more clear.There is a number say n = 1092, we have to get the product of unique prime factors of this. The prime factors of ... Read More

238 Views
Counting set bits means counting 1’S of the given integer. For this, we have multiple solutions that can be applied. For this case, we have a binary number( binary representation of an integer), for which we have to count the number of 1’s off the string.To count the number of 1’s, we will take the string, traverse each element and count all the 1’s of the string. For example, if we input 17 the output will be 2 because the binary of 17 is 10001 that contains two 1's.Input: Enter a positive integer: 6 Output: 2ExplanationThe binary representation of 6 ... Read More

347 Views
In this article, we will learn how to count all distinct binary strings of length n such that no two 1's appear consecutively. We'll explore this problem using both recursive and dynamic programming approaches in C and C++. What is a Binary String? A binary string is a sequence of characters that contains only '0' and '1'. It represents information in base-2 format. For example, "0101" is a binary string of length 4. We are given a positive integer n, and our task is to count all possible distinct binary strings of length n that do not contain ... Read More