def full_huff_search(tree): loops = 0 to_test = deque(hs.group(tree)) #defective = 0 while to_test: #print('in here') loops+=1 current = to_test.popleft() branch_sum = sum([t[0] for t in current]) if branch_sum != 0: return loops else: l,r = hs.group(current) to_test.extendleft([r]) to_test.extendleft([l]) return 0
def search_hufftree(tree): defective = 0 l, r = hs.group(tree) if any(l): search_hufftree(l) else: search_hufftree(r) return defective
def search_hufftree(items): defective = 0 tree = hs.encode(items) l, r = hs.group(tree) return defective