Ayush Gupta has Published 541 Articles

Iterator Invalidation in C++ program

Ayush Gupta

Ayush Gupta

Updated on 01-Apr-2020 06:47:34

99 Views

In this tutorial, we will be discussing a program to understand iterator invalidation in C++.While iterating over the elements of a container object, sometimes it can become invalidated if we don’t apply bound checks. This mainly occurs due to the change in the shape and size of the container object.Example Live ... Read More

MakeFile in C++ and its applications

Ayush Gupta

Ayush Gupta

Updated on 01-Apr-2020 06:46:17

159 Views

In this tutorial, we will be discussing a program to understand MakeFile in C++ and its applications.The task is to break the entire program with MakeFile. It is usually done by making .cpp files and .h files with all the classes/functionalities and link them together.Examplemain.cpp#include #include "function.h" using namespace ... Read More

Kruskal’s Minimum Spanning Tree using STL in C++

Ayush Gupta

Ayush Gupta

Updated on 01-Apr-2020 06:43:15

389 Views

In this tutorial, we will be discussing a program to understand Kruskal’s minimum spanning tree using STL in C++.For this, we will be provided with a connected, undirected and weighted graph. Our task is to calculate the Minimum spanning tree for the given graph.Example Live Demo#include using namespace std; typedef pair ... Read More

Lower bound in C++

Ayush Gupta

Ayush Gupta

Updated on 01-Apr-2020 06:41:03

224 Views

In this tutorial, we will be discussing a program to understand the lower bound in C++.lower_bound() method in C++ is used to return the very first number in the container object which is not less than the given value.Example Live Demo#include int main(){    std::vector v{ 10, 20, 30, 40, ... Read More

Iseek() in C/C++ to read the alternate nth byte and write it in another file

Ayush Gupta

Ayush Gupta

Updated on 01-Apr-2020 06:38:41

526 Views

In this tutorial, we will be discussing a program to understand how to read the alternate nth byte and write it in another file.For this, we will be provided with two .txt files. Our task is to write the contents from one file to another file using Iseek() which is ... Read More

Loops in C and C++

Ayush Gupta

Ayush Gupta

Updated on 01-Apr-2020 06:36:06

214 Views

In this tutorial, we will be discussing a program to understand loops in C and C++.Looping in programming is used when we have to execute a given block code again and again. It takes in the approach for writing the same code line again and again and promoted DRY code ... Read More

Internal details of std::sort() in C++

Ayush Gupta

Ayush Gupta

Updated on 01-Apr-2020 06:31:34

173 Views

In this tutorial, we will be discussing a program to understand the internal details of std::sort() in C++.std::sort() function is used to sort down an array using a comparison of the elements. If we look at the in-depth functionality of std::sort() it uses IntroSort algorithm to sort the elements of ... Read More

INT_MAX and INT_MIN in C/C++ and Applications

Ayush Gupta

Ayush Gupta

Updated on 01-Apr-2020 06:30:53

2K+ Views

In this tutorial, we will be discussing a program to understand INT_MAX and INT_MIN in C/C++.INT_MIN and INT_MAX are macros that are defined to set the minimum and maximum value for a variable/element.Example Live Demo#include int main(){    printf("%d", INT_MAX);    printf("%d", INT_MIN);    return 0; }Output2147483647 -2147483648ApplicationCalculating MIN value in ... Read More

Integer literal in C/C++ (Prefixes and Suffixes)

Ayush Gupta

Ayush Gupta

Updated on 01-Apr-2020 06:29:25

1K+ Views

In this tutorial, we will be discussing a program to understand integer literal in C/C++ (Prefixes and suffixes).Integer literals are literals for integer values directly represented in the source code. Further, they are of two types −Prefixes − Prefixes denotes the base of the value. For example, 0x10 indicates hexadecimal ... Read More

Insertion sort using C++ STL

Ayush Gupta

Ayush Gupta

Updated on 01-Apr-2020 06:20:53

544 Views

In this tutorial, we will be discussing a program to understand the insertion sort using C++ STL.In this we use std::upper_bound to find the element at the wrong position, then rotate the unsorted part of the array to make it sorted.Example Live Demo#include //function to perform insertion sort void insertionSort(std::vector ... Read More

Advertisements