Find Root using Newton-Raphson method in C++

Newton-Raphson Method: The Newton-Raphson method (also known as Newton’s method) is a way to quickly find a good approximation for the root of a real-valued function f(x) = 0f(x)=0. It uses the idea that a continuous and differentiable function can be approximated by a straight line tangent to it. Newton-Raphson formula:               … Read more

Rearrange Array’s Even and Odd values in Ascending order C++

In this post we will understand the problem of rearranging the array’s even and odd values in Ascending order, then we will discuss the best possible approach and then write a C++ code to implement the solution. Let’s discuss the problem: Given: An array of integers with equal number of even and odd values. Problem: … Read more

Sort even number in ascending order and odd number in descending order C++

Given: An array of integers containing even and odd numbers. Problem: For the given array sort even number in ascending order and then sort all the odd numbers in descending order. Then arrange odd numbers first and then arrange the even numbers. Examples: Input : arr[] = {1, 2, 3, 5, 4, 7, 10} Output : … Read more