C++ Program to Find closest number in array
Given an array of sorted integers. We need to find the closest value to the given number. Array may contain duplicate values and negative numbers....
read more
How to implement text Auto-complete feature using Ternary Search Tree
Given a set of strings S and a string patt the task is to autocomplete the string patt to strings from S that have patt as a prefix, using a Ternary Search Tree. If no string matches the given prefix, print “None”.Examples:...
read more
Check if a given number is a Perfect square using Binary Search
Check if a given number N is a perfect square or not. If yes then return the number of which it is a perfect square, Else print -1....
read more
Dynamic Segment Trees : Online Queries for Range Sum with Point Updates
Prerequisites: Segment TreeGiven a number N which represents the size of the array initialized to 0 and Q queries to process where there are two types of queries:...
read more
Frequency of an integer in the given array using Divide and Conquer
Given an unsorted array arr[] and an integer K, the task is to count the occurrences of K in the given array using the Divide and Conquer method....
read more
What is the difference between Set vs Hashset in C++?
In C++, both set and HashSet(also called unordered_set) are used to store elements but they have different properties and use cases. In this article, we will learn the key differences between a set and a HashSet in C++....
read more
How to Create Deque of Unordered_Set in C++?
In C++, a deque (double-ended queue) is a container that allows insertion and removal of elements from both ends whereas an unordered set is a container that stores unique elements in no particular order. In this article, we will learn how to create a deque of unordered sets in C++ STL....
read more
max_bucket_count() Function in Unordered Set C++ STL
Prerequisite: unordered_set() in C++...
read more
Ternary number system or Base 3 numbers
A number system can be considered as a mathematical notation of numbers using a set of digits or symbols. In simpler words, the number system is a method of representing numbers. Every number system is identified with the help of its base or radix....
read more
StringStream in C++ for Decimal to Hexadecimal and back
Stringstream is stream class present in C++ which is used for doing operations on a string. It can be used for formatting/parsing/converting a string to number/char etc. Hex is an I/O manipulator that takes reference to an I/O stream as parameter and returns reference to the stream after manipulation. Here is a quick way to convert any decimal to hexadecimal using stringstream:...
read more
Working and Examples of bind () in C++ STL
In C++, the std::bind function is a part of the Standard Template Library (STL) and it is used to bind a function or a member function to a specific object or value. It creates a new function object by “binding” a function or member function to a specific object or value, allowing it to be called with a different number of arguments or with a different order of arguments....
read more
C++ Program to Check String is Containing Only Digits
Prerequisite: Strings in C++...
read more