xTristan's Brain Dump
Showing posts with label
Recursion
.
Show all posts
Showing posts with label
Recursion
.
Show all posts
Thursday, July 8, 2010
Checking whether a binary tree is balanced or not using recursion
Balanced
: no path from root to leaf node is longer than another such path by 1.
The code is just so elegant...
this can be extended to general trees with more than two children by examining all children's maxDepth or minDepth.
Older Posts
Home
Subscribe to:
Posts (Atom)
About Me
xTristan
Seattle, WA, United States
View my complete profile
Blog Archive
▼
2012
(1)
▼
June
(1)
django+postgres setup
►
2011
(6)
►
March
(4)
►
January
(2)
►
2010
(11)
►
December
(1)
►
November
(1)
►
September
(1)
►
August
(3)
►
July
(5)
►
2008
(2)
►
March
(1)
►
January
(1)
►
2007
(9)
►
September
(4)
►
July
(1)
►
March
(3)
►
February
(1)
Labels
Algorithm
(9)
NesC
(4)
Bitwise Operations
(3)
Interview Questions
(3)
Job Hunting
(3)
mysql
(3)
Data Structure
(2)
Dynamic Programming
(2)
Linked List
(2)
Linux
(2)
TinyOS
(2)
string pattern matching
(2)
.Net
(1)
32bit
(1)
64bit
(1)
ArrayList
(1)
Balanced
(1)
Binary Tree
(1)
CVS
(1)
Constraints
(1)
Database
(1)
Division
(1)
Equal Possibility Distribution
(1)
Git
(1)
Google
(1)
Graph
(1)
Hashtable
(1)
Online Selection
(1)
Packet Format
(1)
Prime Number
(1)
Programming Tricks
(1)
Rails
(1)
Random Selection
(1)
Randomized-Select
(1)
Recursion
(1)
Registry
(1)
Restart Server
(1)
RoR
(1)
Ruby
(1)
Selection Sort
(1)
Serial Active Message
(1)
Server
(1)
Sorting
(1)
Square Number
(1)
Swapping
(1)
Syntax Highlighting
(1)
Ubuntu
(1)
UltraEdit
(1)
Unknown Size
(1)
Version Control
(1)
anagrams
(1)
binary
(1)
c++
(1)
conflicting types
(1)
delete
(1)
global variables
(1)
installation
(1)
mac
(1)
shell commands
(1)
typedef
(1)
uninstall
(1)
wildcards
(1)