Ravi Ranjan has Published 148 Articles

C++ Program to Perform Uniform Binary Search

Ravi Ranjan

Ravi Ranjan

Updated on 18-Aug-2025 16:07:46

406 Views

In this article, we have a sorted array of integers. Our task is to perform a uniform binary search to search for a target element. What is Uniform Binary Search? The uniform binary search is an improved version of the binary search algorithm where we use a pre-computed lookup ... Read More

Binary Search on Singly Linked List in C++

Ravi Ranjan

Ravi Ranjan

Updated on 08-Aug-2025 14:40:31

2K+ Views

In this article, we are given a sorted singly linked list, and our task is to search for a given node using a binary search algorithm. The binary search algorithm works on the divide-and-conquer principle as it keeps dividing the list in half before searching. To search for an element ... Read More

Binary Search in C++

Ravi Ranjan

Ravi Ranjan

Updated on 08-Aug-2025 14:26:16

19K+ Views

The binary search algorithm works as per the divide-and-conquer principle, as it keeps dividing the array in half before searching. To search for an element in an array using binary search, it should be sorted. In the sorted array, we find the middle element and compare it with the element ... Read More

Binary Search a String in C++

Ravi Ranjan

Ravi Ranjan

Updated on 06-Aug-2025 19:01:28

4K+ Views

The binary search algorithm works on the divide-and-conquer principle as it keeps dividing the array in half before searching. To search for an element in an array using binary search, it should be sorted. In the sorted array, we find the middle element and compare it with the element ... Read More

Check if a number can be represented as sum of non zero powers of 2 in C++

Ravi Ranjan

Ravi Ranjan

Updated on 04-Aug-2025 19:01:46

316 Views

In this article, our task is to check if we can represent a given number as the sum of two non-zero powers of 2 in C++. For this, we will check whether the given number N can be represented as (2^x + 2^y) where x, y > 0. Here are ... Read More

C++ code to find minimum arithmetic mean deviation

Ravi Ranjan

Ravi Ranjan

Updated on 31-Jul-2025 12:03:45

268 Views

The arithmetic mean deviation or mean absolute deviation is the summation of the absolute differences of each element and the mean of the dataset, then dividing it by the total number of data elements. To calculate the minimum arithmetic mean deviation, we used the median of the ... Read More

Area of the Largest Triangle inscribed in a Hexagon in C++

Ravi Ranjan

Ravi Ranjan

Updated on 28-Jul-2025 17:57:50

371 Views

In this problem, our task is to find the area of the largest triangle that can be inscribed in a regular hexagon. Each side of the hexagon and triangle is of length a and b, respectively. Area of the Largest Triangle Inscribed in a Hexagon You can ... Read More

C++ program to find the Area of the circumcircle of any triangles with sides given?

Ravi Ranjan

Ravi Ranjan

Updated on 28-Jul-2025 14:09:31

260 Views

Circumcircle of Triangle A circumcircle of a triangle is a circle that passes through all the vertices of a triangle. The center of circumcircle is known as the circumcenter, which is an intersection of all the perpendicular bisectors of the triangle. The radius is known as the ... Read More

Area of a square from diagonal length in C++

Ravi Ranjan

Ravi Ranjan

Updated on 28-Jul-2025 14:08:37

319 Views

A diagonal of a polygon is the line joining two vertices that are not adjacent to each other. The formula for calculating the area of a square with diagonal length is a2 = d2 / 2, where a and d are the side and diagonal length of the square, ... Read More

Area of a triangle inside a parallelogram in C++

Ravi Ranjan

Ravi Ranjan

Updated on 28-Jul-2025 14:07:59

571 Views

The area of a triangle is given as (base * height) / 2, and the area of a parallelogram is base * height. For calculating the area of the triangle inside the parallelogram, we divide the area of the parallelogram by 2, i.e., (base * height) / 2, ... Read More

Advertisements