×
Home Discussions Write at Opengenus IQ
×
  • DSA Cheatsheet
  • HOME
  • Track your progress
  • Deep Learning (FREE)
  • Join our Internship 🎓
  • RANDOM
  • One Liner

List of Mathematical Algorithms

This is the ultimate list of Mathematical Algorithms. These are algorithms that utilize insightful mathematical ideas at its core.

Algorithms

Boyer Moore majority vote algorithm [Majority Element]

Boyer Moore voting algorithm is used to find the majority element among the given sequence of elements which occurs more than N/2 times, in linear time complexity and constant space complexity.

Shreya Shah Shreya Shah
Algorithms

Number of rectangles from a given set of points

We have discussed how to find the number of rectangles (parallel to the axes) possible from a given set of coordinate points.

Shreya Shah Shreya Shah
Algorithms

Factorial of large numbers

Factorial of a non-negative number n, denoted by n!, is the product of all positive numbers less than or equal to n. With the usual approach, we can compute factorial only till 20! due to size limitation of data type. We have present how to overcome this limitation.

Shreya Shah Shreya Shah
Algorithms

Move negative elements to front of array

This article focuses on the algorithm to move the negative elements of an array to the front. This can be solved by the two-pointer approach.

Siddhant Rao
Algorithms

Find GCD of all elements in an array

In this article, we have presented an algorithm to find the Greatest Common Divisor (GCD) of all elements of an array efficiently.

Siddhant Rao
List of Mathematical Algorithms

Equilibrium Index: Find index such that sum of left sub-array = right sub-array

For a given array, we need to find an index such that sum of left sub-array = right sub-array also called the Equilibrium Index. We solve this using brute force approach O(N^2) and using prefix array in linear O(N) time.

Shreya Shah Shreya Shah
Algorithms

Finding LCM of an array of numbers

Find the LCM of the given array of positive numbers. We have explored 2 approaches: one using GCD and other without using GCD.

Aditya Kumar Saroj
Algorithms

Maximum XOR of two numbers in an array using Trie

Given a list of numbers we need to identify a pair of numbers in the list such that the XOR of those numbers is the maximum possible over all the pairs.

Rohit Topi
Algorithms

Munchausen Number

A number that is equal to the sum of its digits each raised to the power equal to its digit is a Munchausen Number or perfect digit-to-digit invariant(PDDI).

Vikranth R Gaddam Vikranth R Gaddam
Algorithms

Counting derangements

Given any integer N, we need to find out the number of Derangements for a set of N elements.

Amruta U. Koshe Amruta U. Koshe
Algorithms

What is a Disarium Number?

A disarium number is a number in which the sum of the digits to the power of their respective position is equal to the number itself (position is counted from left to right starting from 1).

Shubham Sood Shubham Sood
Algorithms

Minimum steps to make binary string empty by removing alternating subsequence in each step

Given a string str consisting of only '0's and '1's, the task is to make the string empty by performing minimum number of operations. An operation is defined as the removal of an alternating subsequence from str without changing the order of the remaining characters.

Aditya Kumar Saroj
Algorithms

Minimum elements to be removed from array to make the sum even

Given an array of integer and you have to find minimum no of integers or elements from array need to be removed so that sum of all elements of array results an even value.

Aayushi Ghadiya
Algorithms

Find number of solutions of a linear equation of N variables

We have to find the number of solutions to a linear equation of N variables. We have solved this using Dynamic Programming.

Shrey Tripathi
Algorithms

Algorithms for Calculating Day of Week

Some of the Algorithms for Calculating Day of Week are: Tomohiko Sakamoto Algorithm, Gausses Algorithm and Wang's Algorithm. We have covered the basics of Julian and Georgian calender as well.

Anjali Chaturvedi Anjali Chaturvedi
Software Engineering

SHA1 Algorithm (+ JavaScript Implementation)

In this article, we have explained the algorithmic steps in SHA1 Algorithm in depth. We have demonstrated an example by implementing SHA1 algorithm in JavaScript.

Mohammed Ajmal Siddiqui
Algorithms

Minimum number of increment operations to make K elements of an array equal

Given an array arr[] of n elements and an integer k, the task is to make any k elements of the array equal by performing only increment operations. This is solved using sliding window technique.

Aarushi Ghadiya
Algorithms

Tomohiko Sakamoto Algorithm

Tomohiko Sakamoto Algorithm is used to find the Day of the week for a given date. The date is provided according to the Gregorian Calendar.

Ishaan Ahuja
Algorithms

Minimum number of operations to make XOR of array equal to zero

You are given an array of n non-negative integers. Your task is to find the minimum number of operations to make XOR of array equal to zero.

Raghav Somani
Algorithms

Carmichael Number

Carmichael Number is an odd composite number which follows the following condition applicable in Fermat's Little Theorem.

Piyush Rajendra Chaudhari Piyush Rajendra Chaudhari
Algorithms

Minimum Bitwise OR operations to make any two array elements equal

Given an array of integers and an integer K, we can perform the Bitwise OR operation between K and elements of the array any number of times. We have to count minimum number of such operations that are required to make any two elements of the array equal.

Ishaan Ahuja
Algorithms

Gale Shapley Algorithm for Stable Matching problem

Gale Shapley Algorithm is an efficient algorithm that is used to solve the Stable Matching problem. It takes O(N^2) time complexity where N is the number of people involved.

Tushti
Algorithms

Minimum Increment and Decrement operations to make array elements equal

We are given an array, we need to find the minimum number of increment and decrement operations (by 1) required to make all the array elements equal. We have explored two approaches where brute force approach take O(N^2) time while the efficient approach O(N logN) time.

Tushti
Algorithms

Minimum number of increment (by 1) operations to make elements of an array unique

We are given a sorted array which might have duplicate elements, our task is to find the minimum number of increment (by 1) operations needed to make the elements of an array unique. We have solved this using two approaches one using two pointers and other using hashmap.

Tushti
Algorithms

Applications of Catalan Numbers

In this article, we have explored different applications of Catalan Numbers such as number of valid parenthesis expressions, number of rooted binary trees with n internal nodes, number of ways are there to cut an (n+2)-gon into n triangles and many more.

Khushi Priya
OpenGenus IQ © 2025 All rights reserved â„¢
Contact - Email: team@opengenus.org
Primary Address: JR Shinjuku Miraina Tower, Tokyo, Shinjuku 160-0022, JP
Office #2: Commercial Complex D4, Delhi, Delhi 110017, IN
Top Posts LinkedIn Twitter
Android App
Apply for Internship