Re: [BLACKBOX] AVL Trees

From: Campbell, Robert (SELEX GALILEO, UK) <robert.d.campbell{([at]})nowhere.xy>
Date: Mon, 5 Sep 2011 10:03:50 +0100

----boundary-LibPST-iamunique-367555595_-_-
Content-type: text/plain

Bob

Thanks for the reference (why didn't I look there first?)

In section 4.5.2, in procedure "balanceR", there is an assignment "b2 :p2.bal;".

b2 is neither declared or used, and this assigment is not in the mirror
procedure "balanceR". I guess that
it is there by error, and should simply be omitted. When I do that the
procedure seems to work.

Is there another version of the book (Pascal or Modula-II) on the web so
I can check what they say?



Wirth also says "It is indeed difficult to beat the straighforward,
simple tree insertion algorithm". I am inclined to agree.
The complexity of AVL trees may be an optimisation beyond what I
currently need, but interesting all the same.


Thanks

Robert


 

>> -----Original Message-----
>> From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
>> Of Bob Walkden
>> Sent: 03 September 2011 10:21
>> To: BLACKBOX{([at]})nowhere.xy
>> Subject: Re: [BLACKBOX] AVL Trees
>>
>> *** WARNING ***
>>
>> This message has originated outside your organisation,
>> either from an external partner or the Global Internet.
>> Keep this in mind if you answer this message.
>>
>>
>> My edition of Wirth's Algorithms & Data Structures includes
>> an example which shows insertion and deletion. It's a
>> Modula-2 version.
>>
>> There's an Oberon version here (pdf download):
>> <http://www.ethoberon.ethz.ch/WirthPubl/AD.pdf>
>>
>> The AVL algorithms are in section 4.5ff.
>>
>> B
>>
>> > -----Original Message-----
>> > From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
>> Of Robert
>> > Sent: 03 September 2011 10:16
>> > To: BLACKBOX{([at]})nowhere.xy
>> > Subject: [BLACKBOX] AVL Trees
>> >
>> > Hiya
>> >
>> > Has anyone published an AVL-Tree module (preferably with some
>> > documentation)?
>> >
>> > I thought there was a good example in "Modula-2" by John
>> Beidler & Paul
>> > Jackowitz, but after translating their code (which was easy!) I
>> > realised that it
>> > only included insertion, and other operations such as deletion were
>> > actually
>> > even more tricky!
>> >
>> > Cheers
>> >
>> > Robert
>> >

>> >
>> > ----
>> > To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to
>> > LISTSERV{([at]})nowhere.xy
>>
>>
>> ----
>> To unsubscribe, send a message with body "SIGNOFF BLACKBOX"
>> to LISTSERV{([at]})nowhere.xy
>>
SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-367555595_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIEJvYlxwYXINClxwYXINClRoYW5rcyBmb3IgdGhl
IHJlZmVyZW5jZSAod2h5IGRpZG4ndCBJIGxvb2sgdGhlcmUgZmlyc3Q/KVxwYXINClxwYXINCklu
IHNlY3Rpb24gNC41LjIsIGluIHByb2NlZHVyZSAiYmFsYW5jZVIiLCB0aGVyZSBpcyBhbiBhc3Np
Z25tZW50ICJiMiA6PVxwYXINCnAyLmJhbDsiLlxwYXINClxwYXINCmIyIGlzIG5laXRoZXIgZ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W50cyB0byBhbnkgb3RoZXIgcGVyc29uLlxwYXINCioqKioqKioqKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
XHBhcg0KXHBhcg0KXHBhcg0KLS0tLVxwYXINClRvIHVuc3Vic2NyaWJlLCBzZW5kIGEgbWVzc2Fn
ZSB3aXRoIGJvZHkgIlNJR05PRkYgQkxBQ0tCT1giIHRvIExJU1RTRVJWQExJU1RTLk99fQAgMuDA
QVJOSU5HZBI
----boundary-LibPST-iamunique-367555595_-_---
Received on Mon Sep 05 2011 - 11:03:50 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:11 UTC