Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pole = [...]
- vlozeno = [False, False, ...]
- N = len(pole)
- MAX_DEPTH = ciel(log(2, N))
- vloz_prvek(N // 2, 1)
- def vloz_do_stromu(prvek):
- ...
- def vloz_prvek(int pozice, int curr_depth):
- return if curr_depth == MAX_DEPTH
- if not vlozeno[pozice]:
- vloz_do_stromu(pole[pozice])
- vlozeno[pozice] = True
- if curr_dept != max_depth:
- pozice_left = pozice - int(N * (2 ^ - curr_depth))
- vloz_prvek(pozice_left, curr_depth + 1)
- pozice_right = pozice + int(N * (2 ^ - curr_depth))
- vloz_prvek(pozice_right, curr_depth + 1)
Advertisement
Add Comment
Please, Sign In to add comment