Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 5! = 5 * 4 * 3 * 2 * 1 = 120
- 6! = 6 * 5 * 4 * 3 * 2 * 1 = 720
- 7! = 7 * 6 * 5 * 4 * 3 * 2 * 1 = 5040
- ...
- 25! = 25 * 24 * ... * 2 * 1 = 15,511,210,043,330,985,984,000,000
- ...
- 50! = 50 * 49 * ... * 2 * 1 = 3.04140932... × 10^64
- actualAlgorithmTime(N) ∈ O(t(N)) ("the problem is O(t(N))")
- actualAlgorithmTime(N)
- ───────────────────── == constant ("we'll never do worse than [const]*t(N)")
- t(N)
- "For large enough inputsize=N, if I double the input size...
- ... I double the time it takes." ( O(N) )
- ... I quadruple the time it takes." ( O(N^2) )
- ... I add 1 to the time it takes." ( O(log(N)) )
- ... I don't change the time it takes." ( O(1) )
- int Sum(int*arr,int size){ int sum=0;while(size-->0) sum+=arr[size]; return sum;}
- void Combination(int*arr,int size)
- { int outer=size,inner=size;
- while(outer -->0) {
- inner=size;
- while(inner -->0)
- cout<<arr[outer]<<"-"<<arr[inner]<<endl;
- }
- }
Add Comment
Please, Sign In to add comment