Advertisement
Guest User

Untitled

a guest
Apr 30th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. def sub_decodeTree(dataIN,iL):
  2.     res = None
  3.     if iL[0] < len(dataIN):
  4.         res = binTree.BinTree(None,None,None)
  5.         if dataIN[iL[0]] == '0':
  6.             iL = [iL[0]+1]
  7.             res.left = sub_decodeTree(dataIN,iL)
  8.             iL = [iL[0]+9]
  9.             res.right = sub_decodeTree(dataIN,iL)
  10.         else:
  11.             word = ''
  12.             for i in range(8):
  13.                 word += dataIN[iL[0]+i+1]
  14.             word = toBinary(word)[0]
  15.             res.key = word
  16.     return res
  17.  
  18. swag = sub_decodeTree('0010111010010110001001011000010101100011101100101',[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement