Category: array
Sort an Array in Descending Order in C++
In this article, we will discuss six different ways to sort an array in descending order in C++. How to sort an Array in C++? Subscribe Table Of Contents Sort Array in Descending Order in C++ using STL’s std::sort() Sort Array in Descending Order using Bubble Sort Sort Array in Descending Order using Insertion Sort …
Find index of an element in an Array in C++
In this article, we will discuss different ways to find the index of an element in an array in C++. Table of Contents Find index of element in Array using Linear traversal (Iterative Method) Find index of element in Array using STL function std::find() Summary Here we are given an array and we have to …
Find maximum value and its index in an Array in C++
In this article, we will discuss different ways to find the maximum value in an array and also its index position. Table Of Contents Find Maximum value in Array using Linear traversal : Iterative Method Find Maximum value in Array using STL function max_element() and find() Find Maximum value in Array using max() & find() …
Find maximum value and its index in an Array in C++Read More
How to Compare Arrays for equality in C++?
In this article, we will discuss how to compare two arrays in C++. Table Of Contents Problem Description Compare Arrays using Linear traversal (Iterative Method) Compare Arrays using STL function equal() Summary Problem Description Here, we are given two arrays, and we have to find if they are equal or not. Advertisements Input int arr1[] …
How to check if an Array is Sorted in C++
In this article, we will discuss different ways to check if an array is sorted or not in C++. Table Of Contents Problem Description Check if array is sorted using std::adjacent_find() Check if array is sorted using std::is_sorted() Check if array is sorted using Recursive Approach Check if array is sorted using Iterative Approach Summary …
Find minimum value and its index in an Array in C++
In this article, we will discuss different ways to find the minimum value in an array and also its index position. Table Of Contents Problem Description Find Min value in Array using Linear traversal -(Iterative Method) Find Min value in Array using STL function Find Min value in Array using min() and find() Summary Problem …
Find minimum value and its index in an Array in C++Read More
Sort an Array in Ascending Order in C++ (6 Ways)
In this article, we will discuss different ways to sort an array in C++. How to sort an Array in C++? Subscribe Table Of Contents Problem Description Sort an Array in C++ using STL function sort() Sort an Array in C++ using Bubble Sort Approach Sort an Array in C++ using Insertion Sort Approach Sort …
How to Sort an Array of structs in C++?
In this article, we will discuss different ways to sort an array of structs in C++. How to sort an Array in C++? Subscribe Table Of Contets Problem Statement Sorting array of structs using STL sort() in C++ Using sort() with a function as comparator Using sort() with a Lambda function as comparator Sorting an …
How to Sort an Array of pairs in C++?
In this article, we will discuss different ways to sort an array of std::pair in C++. How to sort an Array in C++? Subscribe Table Of Contents Problem Statement Sort Array of Pairs using STL sort() function Using Normal Function as argument in sort() Using Lambda Function as argument in sort() Sort Array of Pairs …
How to Convert a char array to String in C++?
In this article, we will discuss different ways to convert a char array to a string in C++. Table Of Contents Problem Description Convert char array to string using simple addition Convert char array to string using stringstream Convert char array to string using push_back() function Summary Problem Description We have given an array that …