Emania

Untitled

Apr 14th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. pole = [...]
  2. vlozeno = [False, False, ...]
  3. N = len(pole)
  4. MAX_DEPTH = ciel(log(2, N))
  5. vloz_prvek(N // 2, 1)
  6.  
  7. def vloz_do_stromu(prvek):
  8. ...
  9.  
  10. def vloz_prvek(int pozice, int curr_depth):
  11. return if curr_depth == MAX_DEPTH
  12. if not vlozeno[pozice]:
  13. vloz_do_stromu(pole[pozice])
  14. vlozeno[pozice] = True
  15. if curr_dept != max_depth:
  16. pozice_left = pozice - int(N * (2 ^ - curr_depth))
  17. vloz_prvek(pozice_left, curr_depth + 1)
  18. pozice_right = pozice + int(N * (2 ^ - curr_depth))
  19. vloz_prvek(pozice_right, curr_depth + 1)
Advertisement
Add Comment
Please, Sign In to add comment