Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.
/ superbalanced Public archive

We'll tackle this problem together using the coding/refactoring style described in Sandi Metz's "99 Bottles of OOP"

Notifications You must be signed in to change notification settings

jpendry/superbalanced

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Book Club Practice Problem

Write a function to see if a binary tree is "superbalanced" (a new tree property we just made up).

A tree is "superbalanced" if the difference between the depths of any two leaf nodes is no greater than one.

Here's a sample binary tree node class:

  class BinaryTreeNode(object):

    def __init__(self, value):
        self.value = value
        self.left  = None
        self.right = None

    def insert_left(self, value):
        self.left = BinaryTreeNode(value)
        return self.left

    def insert_right(self, value):
        self.right = BinaryTreeNode(value)
        return self.right

About

We'll tackle this problem together using the coding/refactoring style described in Sandi Metz's "99 Bottles of OOP"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages