Bottom-up Iterative Segment Tree
ধরা যাক, আমাদের একটি array আছে: a = [5, 2, 7, 3, 6, 1, 4, 8] আমাদের দুই ধরনের operation করতে হবে: একটি position-এর value update করা। কোনো range-এর sum বের করা। উদাহরণ: sum of a[2...6] সরাসরি loo

The Graph → The Python code to find the shortest path in the above ⬆️ graph → from collections import deque from typing import List, Tuple, Optional def bfs(n: int, graph: List[List[int]], source: int) -> Tuple[List[float], List[int]]: """ ...

Binary Search def bi_search(arr, target): low = 0 high = len(arr) - 1 index = None while low <= high: mid = low + (high - low) // 2 if target == arr[mid]: index = mid break elif target ...