https://ymusicapp.com/watch?v=Ic7OO3Uw6J0

https://www.shafaetsplanet.com/?p=1557

See whitelakecodes/DSA/segment tree/Vector edition code with comments

Complexity: To build nlog n, as there is n leaf nodes, and each can be traversed at logn time. (As perfectly balanced binary tree).

To query/update, it needs logn.