Sunidhi Bansal has Published 1085 Articles

Maximum and minimum of an array using minimum number of comparisons in C

Sunidhi Bansal

Sunidhi Bansal

Updated on 17-Aug-2020 08:30:24

13K+ Views

We are given with an array of integers. The task is to find the minimum and maximum element of the array in the minimum number of comparisons.Input Arr[] = { 1, 2, 4, 5, -3, 91 }Output Maximum element : 91 Minimum Element : -3Explanation − Here to minimize the number of ... Read More

Maximum absolute difference of value and index sums in C

Sunidhi Bansal

Sunidhi Bansal

Updated on 17-Aug-2020 08:28:33

962 Views

We are given with an array of integers. The task is to calculate the maximum absolute difference of value and index sums. That is for each pair of indexes (i, j) in an array, we have to calculate | Arr[i] - A[j] | + |i-j| and find the maximum such ... Read More

Different methods to copy in C++ STL - std::copy(), copy_n(), copy_if(), copy_backwards()

Sunidhi Bansal

Sunidhi Bansal

Updated on 14-Aug-2020 08:43:35

458 Views

As the method name suggests copy() method is used to copy the data through various methods available in C++ STL. All the methods differ in functionalities and the parameters. These methods are available in header file. Let’s discuss each method and their functionalities.Copy(start_i1, end_i1, start_i2)This method is used to ... Read More

Different ways to declare variable as constant in C and C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 14-Aug-2020 08:40:57

885 Views

There are multiple ways of declaring constants in C and C++. First of all, we need to understand what constant is.What is a Constant?Constant means which can’t be changed. In terms of programming, constants are the fixed values that are assigned to the variables such that they can’t be altered ... Read More

Upper bound and Lower bound for non increasing vector in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 14-Aug-2020 08:31:50

4K+ Views

In this article we are going to discuss the vector::upper_bound() and vector::lower_bound() for an array sorted in non-increasing order in C++ STL.Vectors are similar to the dynamic arrays; they have the ability to modify its size itself whenever a value is inserted into or removed from the container where we ... Read More

map count( ) function in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 14-Aug-2020 08:29:37

5K+ Views

In this article we will be discussing the working, syntax and examples of map::empty() function in C++ STL.What is Map in C++ STL?Maps are the associative container, which facilitates to store the elements formed by a combination on key value and mapped value in a specific order. In a map ... Read More

Sin( ) function for complex number in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 14-Aug-2020 08:27:16

180 Views

We are given with the task to find the working of sin() function for complex number. The sin( ) function for complex numbers are present in the complex header file which means for calculating the value of sin() we need to add the complex header file in the code. In ... Read More

Sinh( ) function for complex number in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 14-Aug-2020 08:25:45

227 Views

We are given with the task to find the working of sin() function for complex number. The sin( ) function for complex numbers are present in the complex header file which means for calculating the value of sin() we need to add the complex header file in the code. This ... Read More

map max_size() in C++ STL

Sunidhi Bansal

Sunidhi Bansal

Updated on 14-Aug-2020 08:24:33

1K+ Views

In this article we will be discussing the working, syntax and examples of map::max_size() function in C++ STL.What is a Map in C++ STL?Maps are the associative container, which facilitates to store the elements formed by a combination of key value and mapped value in a specific order. In a ... Read More

map::operator[] in C++ STL Program

Sunidhi Bansal

Sunidhi Bansal

Updated on 14-Aug-2020 08:23:02

450 Views

In this article we will be discussing the working, syntax and example of map equal ‘[]’ operator in C++ STL.What is a Map in C++ STL?Maps are the associative container, which facilitates to store the elements formed by a combination of key value and mapped value in a specific order. ... Read More

Advertisements