SOL 1
<--Back to Home
Week 0 :
Track 1 - Introduction
Analysis of Algorithm
- How do we find which algorithm is better ? - Test Cases - Asymptotic Analysis
- Best Case(Omega Notation) , Average Case(Omega Notation), Worst Case (Big-Oh Notation)
- Shortcomings of Asymptotic analysis : Does not consider the difference caused by constants ie n^2 << n+c (where C might be large)
- Analysis of Loops
Track 2 - Analysis of Recursion
- General Method : Recursion Tree Method
- Requires Learning : Formula,Master Theorem
Track 3 - Time Complexity of a Computer Program
- Cost of a statement, Number of times
- O(1) < O(logn) <O(n) <O(nlogn) < O(n^c) < O(n!)
SOL 2
Track 1 - Mathematics
- Finding Number of Digits in a Number
- Arithmetic and Geometric Progression
- Quadratic Equation
- Mean and Median
- Prime Numbers
- LCM and HCF
- Factorials
- Permutation and Combination Basics
- Modular Arithmetic
Problems to Solve
- Calculating the Absolute value without using inbuilt function Method 1
-
Convert Celsius To Fahrenheit Source
-
Calculating the roots of the Quadratic equation Source
-
Factorial of Number RecursionSource
-
Digits in Factorial of a Big Number Source
-
Numbers with Exactly 3 Divisors Source
-
Mean and Median Source
-
Print Digits up to N without loop Source
-
Sum of N Digits in a number Source
-
Digital Roots Source
-
Fibonacci Using Recursion Source
c++
long long fibonacci(int n)
{
if(n<=1)
return n;
else
return fibonacci(n-1)+fibonacci(n-2);
}
- Modulo of 10^9+7 the Answer
int sumUnderModulo(long long a,long long b)
{
int M=1000000007;
//your code here
return ((a%M)+(b%M))%M;
}
- Find the First Bit Set Source
Track 3 - Recursion
- Tower of Hanoi Source
void towerofhanoi(int n,char s,char d ,char aux)
{
if(n==1)
{
cout<<"Move Disk 1 from rod"<<s<< " to rod "<< d <<endl;
return;
}
towerofhanoi(n-1,s,aux,d);
cout<<"Move Disk "<<n<<" from rod"<< s<< "to rod" << d <<endl;
towerofhanoi(n-1, aux, d, s);
}
int josephus(int n, int k)
{
if(n==1)
return 1;
return (josephus(n-1,k)+k-1)%n +1;
}
#include<bits/stdc++.h> add all the libraries to a c file
Track 8 - Sorting
C++ STL Library
#### Vectors
Collection of Specific Types
vector<double> rain(7);
Each of 7 element is of size double with variable name rain
Access each element of array as Index
rain[index_value]