Set in C++

Set in C++ When we want to store unique elements in any data structure then we use set. Sets are containers that store unique elements following a specific order. In a set, the value of an element also identifies it (the value is itself the key, of type T), and each value must be unique. The value of the elements in a set cannot be…

How to sort binary array in O(n).

How to sort binary array containing only 0 and 1? If we have array containing decimal number then it is easy.This is generally asked question in any C++ interview. Problem is to sort an array containing only 0 and 1 as an element in O(n). Following algorithm will sort the array in ascending order.Here you go for the detailed program. How to sort binary array…