Sunidhi Bansal

Sunidhi Bansal

809 Articles Published

Articles by Sunidhi Bansal

Page 48 of 81

Quickly merging two sorted arrays using std::merge() in C++ STL(cute ho ap)

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 2K+ Views

In this article we will be discussing how we can quickly merge two sorted arrays using std::merge() function in C++ STL.So, before solving the problem let's first discuss the std::merge() in C++ STL.What is std::merge()?std::merge() function is an inbuilt function in C++ STL, which is defined in the header file. merge() is used to merge two sorted ranges or series. This function combines two sorted ranges to make one single sorted range. All the elements are compared using less than operator (

Read More

is_reference Template in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 143 Views

In this article we will be discussing the working, syntax and examples of std::is_reference template in C++ STL.is_reference is a template which comes under header file. This template is used to check whether the given type T is a reference type or not.This template is a combination of is_rvalue and is_lvalue and checks whether either if one is true, the result of is_reference will be also true.What is a reference in C++?A reference is an alias or another name of the already existing variable. A reference is different from pointer −As we cannot set a reference as null but ...

Read More

mbrtowc() function in C/C++ program

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 260 Views

In this article we will be discussing the working, syntax and examples of std::mbrtowc() function in C++ STL.What is std::mbrtowc()?std::mbrtowc() function is an inbuilt function in C++ STL, which is defined in the header file. mbrtowc() means that it converts the narrow multibyte character string to wide character. This function is used to convert a narrow multibyte character to wide character representation.Syntaxsize_t mbrtowc( wchar_t* pwc, char* str, size_t n, mbstate_t* ps);ParametersThe function accepts following parameter(s) −pwc − This is the pointer to the location we want the output to be stored.str − Character string which is used as the ...

Read More

Set cbegin() and cend() function in C++ STL

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 313 Views

In this article we are going to discuss the set::cend() and set::cbegin() functions in C++ STL, their syntax, working and their return values.What is Set in C++ STL?Sets in C++ STL are the containers which must have unique elements in a general order. Sets must have unique elements because the value of the element identifies the element. Once added a value in set container later can’t be modified, although we can still remove or add the values to the set. Sets are used as binary search trees.What is set::cbegin():cbegin() function is an inbuilt function in C++ STL, which is defined ...

Read More

Set crbegin() and crend() function in C++ STL

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 220 Views

In this article we are going to discuss the set::crbegin() and set::crend() functions in C++ STL, their syntax, working and their return values.What is Set in C++ STL?Sets in C++ STL are the containers which must have unique elements in a general order. Sets must have unique elements because the value of the element identifies the element. Once added a value in set container later can’t be modified, although we can still remove or add the values to the set. Sets are used as binary search trees.What is set::crbegin()?crbegin() function is an inbuilt function in C++ STL, which is defined ...

Read More

strchr() function in C++ and its applications

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 2K+ Views

In this article, we will be discussing the working, syntax, and examples of strchr() function in C++ STL.What is strchr()?strchr() function is an inbuilt function in C++ STL, which is defined in the header file. strchr() function is used to find when the character first occurred in the string. This function returns the pointer to the location where the character first appeared in the string.If the character doesn’t exist in the string the function returns the null pointer.Syntaxchar* strchr( char* str, char charac );ParametersThe function accepts the following parameter(s)−str − It is the string in which we have to ...

Read More

C Program for focal length of a lens

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 461 Views

Given two floating values; image distance and object distance from a lens; the task is to print the focal length of the lens.What is focal length?Focal length of an optical system is the distance between the center of lens or curved mirror and its focus.Let’s understand with the help of figure given below −In the above figure i is the object, and F is the image of the object which is formed and f is the focal length of the image.So to find the focal length of the image from the lens the formula is −1F= 1O+1IWhere, F is the ...

Read More

C++ Program for Derivative of a Polynomial

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 5K+ Views

Given a string containing the polynomial term, the task is to evaluate the derivative of that polynomial.What is a Polynomial?Polynomial comes from two words: - “Poly” which means “many” and “nomial” means “terms”, which comprises many terms. Polynomial expression is an expression containing variables, coefficients and exponents, which only involves operations such as, addition, multiplication and subtraction of variable(s).Example of polynomialx2+x+1Derivative of the polynomial p(x) = mx^n  will be −m * n * x^(n-1)ExampleInput: str = "2x^3 +1x^1 + 3x^2"    val = 2 Output: 37 Explanation: 6x^2 + 1x^0 + 6x^1    Putting x = 2    6*4 + ...

Read More

Java Program for credit card number validation

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 6K+ Views

Given a long number containing digits of a credit card number; the task is to find whether the credit card number is valid or not with a program.For checking a credit card is valid or not, the following are the validations we have to be sure for declaring the result.A credit card’s number must have 13 to 16 digits, it must start with the following digits.All the visa cards start from 4 All the master cards start from 537 is the starting for American express cardsAll the discover cards start from 6Steps to check whether the credit card is valid or ...

Read More

C++ Program for Optimal Page Replacement Algorithm

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 4K+ Views

Given page number and page size; the task is to find number of hits and misses as when we allocate the memory block to a page using Optimal Page Replacement Algorithm.What is Optimal Page Replacement Algorithm?Optimal page replacement algorithm is a page replacement algorithm. A page replacement algorithm is an algorithm which decides which memory page is to be replaced. In Optimal page replacement we replace the page which is not referred to the near future, although it can’t be practically implemented, but this is most optimal and have minimal miss, and is most optimal.Let’s understand by using an example ...

Read More
Showing 471–480 of 809 articles
« Prev 1 46 47 48 49 50 81 Next »
Advertisements