Ayush Gupta has Published 541 Articles

How to find the maximum element of a Vector using STL in C++?

Ayush Gupta

Ayush Gupta

Updated on 25-Feb-2020 08:08:29

6K+ Views

In this tutorial, we will be discussing a program to understand how to find the maximum element of a vector using STL in C++.To find the maximum element from a given vector, we will be using the *max_element() method from STL library.Example Live Demo#include using namespace std; int main(){   ... Read More

How to find common elements between two Vectors using STL in C++?

Ayush Gupta

Ayush Gupta

Updated on 25-Feb-2020 08:05:48

734 Views

In this tutorial, we will be discussing a program to understand how to find common elements between two vectors using STL in C++.To find the common elements between two given vectors we will be using the set_intersetion() method.Example Live Demo#include using namespace std; int main(){    //defining the vectors   ... Read More

How to find common elements between two Arrays using STL in C++?

Ayush Gupta

Ayush Gupta

Updated on 25-Feb-2020 07:59:32

207 Views

In this tutorial, we will be discussing a program to understand how to find common elements between two arrays using STL in C++.To find the common elements between two given arrays we will be using the set_intersetion() method.Example Live Demo#include using namespace std; int main(){    //defining the array   ... Read More

How to create an unordered_set of user defined class or struct in C++?

Ayush Gupta

Ayush Gupta

Updated on 25-Feb-2020 07:49:36

532 Views

In this tutorial, we will be discussing a program to understand how to create an unordered set of user defined class or struct in C++.For this we will create a structure type and then compare two structure types with the function defined by the user to store the hash function.Example#include ... Read More

How to create an unordered_map of user defined class in C++?

Ayush Gupta

Ayush Gupta

Updated on 25-Feb-2020 07:36:24

479 Views

In this tutorial, we will be discussing a program to understand how to create an unordered map of user defined class in C++.To create an unordered map from a user defined class, we will pass the hash function as the class method being the third argument.Example Live Demo#include using namespace ... Read More

How to create an unordered_map of pairs in C++?

Ayush Gupta

Ayush Gupta

Updated on 25-Feb-2020 07:31:23

738 Views

In this tutorial, we will be discussing a program to understand how to create an unordered map of pairs in C++.Unordered maps are the ones that don't contain hash function for the pairs by default. If we want a hash value for a particular pair, it needs to be passed ... Read More

How to create a List with Constructor in C++ STL

Ayush Gupta

Ayush Gupta

Updated on 25-Feb-2020 07:28:17

191 Views

In this tutorial, we will be discussing a program to understand how to create a List with constructor in C++ STL.List are data structures to store elements in memory in a non-contiguous fashion. They are insertion and deletion quick as compared to vectors.Example Live Demo#include #include using namespace std; ... Read More

How to add “graphics.h” C/C++ library to gcc compiler in Linux

Ayush Gupta

Ayush Gupta

Updated on 25-Feb-2020 07:25:35

1K+ Views

In this tutorial, we will be discussing a program to understand how to add “graphics.h” C/C++ library to gcc compiler in Linux.To do this we are required to compile and install the libgraph package.This includes install build-essential and some external packages>>sudo apt-get install build-essential >>sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev ... Read More

How does a vector work in C/C++

Ayush Gupta

Ayush Gupta

Updated on 25-Feb-2020 07:20:01

2K+ Views

In this tutorial, we will be discussing a program to understand how vectors work in C/C++.A vector data structure is an enhancement over the standard arrays. Unlike arrays, which have their size fixed when they are defined; vectors can be resized easily according to the requirement of the user.This provides ... Read More

Count all sub-sequences having product <= K – Recursive approach in C++

Ayush Gupta

Ayush Gupta

Updated on 17-Feb-2020 10:49:05

150 Views

In this tutorial, we will be discussing a program to find the number of sub-sequences having product k) {       discard_count += power(2, n - i);       return;    }    if (i == n)       return;       float rem = ... Read More

Advertisements