×

# Explain the code

 0 Can someone please explain me what THIS code is doing. I know that it involves DFS on a tree/graph. It might also involve binary search. I want to know that in init() and lca() functions, why i and j are iterated only till 18? Problem Link Contest Link asked 16 Nov '18, 17:32 143●1●6 accept rate: 10%

 0 We want minimum K such that $pow(2,K)>= N$ , here $N = 100000$ . 1.$pow(2,16) = 65536$ 2.$pow(2,17) = 131072$ 3.$pow(2,18) = 262144$ minimum $K$ satisfying above condition is $17$. Any number $>=17$ will do. answered 17 Nov '18, 01:06 2★surerr 1 accept rate: 0%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×1,404
×1,038
×1,000
×726
×708

question asked: 16 Nov '18, 17:32

question was seen: 108 times

last updated: 17 Nov '18, 01:06