Segment Tree-1Segment Tree Basic Node Divide With Segment Tree Node Numbering (Segment Tree) // build (node, begin, end) build (1, 1, N) { L = 2xN, R = (2xN) + 1 // Node Number Calculate mid = (begin + end)Jul 14, 2024 · 3 min readanower-hossain.com
Recursion & Backtracking1-Recursion-Basic #include "bits/stdc++.h" using namespace std; void solve(int n) { if(n==0) return; solve(n-1); cout<< n << " "; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n; cin>>n; solve(n); ...Jul 7, 2024 · 1 min readanower-hossain.com
Lower & Upper BoundBinary Search Lower Bound #include "bits/stdc++.h" using namespace std; int main() { int n; cin>>n; int a[n]; for(int i=0; i<n; i++) cin>>a[i]; auto its = lower_bound(a, a+n, 5); cout<<*its; } input ======= 5 1 3 4 5 6 outp...1SApr 22, 2024 · 1 min readanower-hossain.com