TabbieD / Algorithms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Algorithms

  1. Maximum Pairwise Product Problem. Find the maximum product of two distinct numbers in a sequence of non-negative integers. Input: A sequence of non-negative integers. Output: The maximum value that can be obtained by multiplying two different elements from the sequence.

  2. Fibonnacci numbers. Given an integer n, find the nth fib number F(n). Input: The input consists of a single integer n. Output: F(n)

  3. Least Common Multiple. Given two integers 𝑏 and 𝑐, find their least common multiple. Input: The two integers 𝑏 and 𝑐 are given in the same line separated by space. Constraints: 1 ≀ 𝑏,𝑐 ≀ 2 Β· 10^ 9 . Output: Output the least common multiple of 𝑏 and 𝑐.

  4. Last Digit of the Sum of Fibonacci Numbers. Given two non-negative integers 𝑛 and π‘œ, where 𝑛 ≀ π‘œ, find the last digit of the sum 𝐺 𝑛 + 𝐺 𝑛+1 + Β·Β·Β· + 𝐺 π‘œ . Input: The input consists of two non-negative integers 𝑛 and π‘œ separated by a space. Constraints: 0 ≀ 𝑛 ≀ π‘œ ≀ 10 ^18 . Output: Output the last digit of 𝐺 𝑛 + 𝐺 𝑛+1 + Β·Β·Β· + 𝐺 π‘œ .

  5. Last Digit of the Sum of Squares of Fibonacci Numbers

  6. Efficient greedy algorithm for the following problems:

  • (a) changing money with a minimum number of coins;
  • (b) maximizing the total value of a loot;
  • (c) maximizing revenue in online ad placement;
  • (d) minimizing work while collecting signatures;
  • (e) maximizing the number of prize places in a competition;
  • (f) finally, maximizing your salary!
  1. Efficient algorithms for the following computational problems:
  • (a) searching a sorted data for a key;
  • (b) finding a majority element in a data;
  • (c) improving the quick sort algorithm;
  • (d) checking how close a data is to being sorted;
  • (e) organizing a lottery;
  • (f) finding the closest pair of points.
  1. Change Problem Again: A dynamic programming algorithm for solving the money change problem.

  2. Primitive calculator: A dynamic programming algorithm to find the minimum number of operations needed to get a number n.

  3. Edit Distance: The edit distance between two strings is the minimum number of operations (insertions, deletions, and substitutions of symbols) to transform one string into another. It is a measure of similarity of two strings. Edit distance has applications, for example, in computational biology, natural language processing, and spell checking. The goal in this problem is to compute the edit distance between two strings.