in reply to (Golf) Building a Better Binary Tree
It's strict and warnings compliant. Not a well-adjusted tree, but it's more adjusted than the previous entries:
116 characters. Hmm, this isn't nearly as short as it was when it didn't do anything correctly ;-)#234567890123456789012345678901234567890123456789012345678 $a=shift;@_=sort$a @_;my%a=(pop,[0,0]);$_=$#_;%a=$_>0?($_[ $_-1],[0,0],$_[$_--],{%a}):($_[$_],{%a}),$_--while$_>-1;%a
jynx
update: fixed code to work for base case and sort, modified post to reflect change.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: (Golf) Building a Better Binary Tree
by dragonchild (Archbishop) on Oct 09, 2001 at 16:43 UTC | |
by jynx (Priest) on Oct 09, 2001 at 21:20 UTC |