AHAnower Hossaininanower-hossain.com00Segment Tree-1Jul 14, 2024 · 2 min read · Segment 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) / 2 left = (L, begin, mid) left = (R, ...Join discussion
AHAnower Hossaininanower-hossain.com00Recursion & BacktrackingJul 7, 2024 · 1 min read · 1-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); ...Join discussion
AHAnower Hossaininanower-hossain.com01Lower & Upper BoundApr 22, 2024 · 1 min read · Binary 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...SSowrab commented