/Competitive-Algos-and-Data-Structures

This repository includes the useful algorithims, data structures and concepts I encounter while doing competitive programming.

Primary LanguageC++

Competitive-Algos-and-Data-Structures

This repository includes the useful algorithims, data structures and concepts I encounter while doing competitive programming.

Points to Remember:

  1. Sum of product of all pairs of an array: ((a1 + a2 + ... + an)^2 - (a1^2 + a2^2 + ... + an^2)) / 2
  2. Sieve complexity: O(nlogn)
  3. Chicken McNugget Theorem/Frobenius Coin Theorem: If 'a' and 'b' are two co-prime numbers then: 1. Largest number that can not be expressed in the form ax+by is ab-a-b 2. Count of numbers that can not be expressed in the form ax+by are (a-1)(b-1)/2
  4. Taking ceil of large numbers in C++ : (a+b-1)/b