From: Eugene Kalenkovich Date: 2007-09-07T14:45:07+09:00 Subject: Re: Twisting a Rope (#137) "John Miller" wrote in message news:bc100c94508cad46e34a0d22e95334f8@ruby-forum.com... > Hi All, > > This was the other interesting part of the quiz. Every answer I saw > balanced the tree giving each leaf the same weight. The leaves on the > other hand varied in length between 8 characters and 512k. The > suggested way to balance a Rope was based on the length of the leaves in > such a way that longer leaves were nearer the root because presumably > they will be accessed more often. > At least two implementations did this (James Koppel's and mine). OTOH this added a lot of mess to the code, and a simple change on e.g. Eric's implementation (to use length instead of depth) will achieve practically the same. --EK