Article View: comp.lang.c
Article #126Re: AVL tree insertion - programming exercise
From: Andrey Tarasevich
Date: Sat, 10 Oct 2026 19:39
Date: Sat, 10 Oct 2026 19:39
24 lines
2359 bytes
2359 bytes
On Tue 10/6/2026 11:08 PM, Tim Rentsch wrote: > I offer this small programming exercise for anyone who is > interested. I did exactly that a couple of months ago, except that my case the AVL tree was intended to serve as a carrying sub-structure for an augmented interval tree. I did not make any effort to decouple the implementations, meaning that my AVL implementation is intermixed with the interval tree implementation. Also, I had to support not only operations that start from the root of the tree (like your `add_key`), but also operations that start from a specific arbitrary node (e.q. a `delete_node(Node *)` operation). So, in my case I opted to also keep and maintain the parent link in each node. Extra memory expenditure is not that drastic, especially considering the fact that my nodes are already heavier - carrying geometric data for the interval tree. Meanwhile, you seem to be striving to squeeze out all "unnecessary" memory usage (re: embedding the balance value into the unused pointer bits). Is this a hard requirement in your exercise? -- Best regards, Andrey
Technical Details
Message-ID:
<11ae48u$21bo6$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<86ece2kppv.fsf@linuxsc.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Andrey Tarasevich <noone@noone.net> Newsgroups: comp.lang.c Subject: Re: AVL tree insertion - programming exercise Date: Sat, 10 Oct 2026 12:39:09 -0700 Organization: A noiseless patient Spider Lines: 24 Message-ID: <11ae48u$21bo6$1@dont-email.me> References: <86ece2kppv.fsf@linuxsc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 10 Oct 2026 19:39:11 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2141958"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19H9ybnnUUBwNDqG3IA1rbU"; posting-host="7f801c3fa9925236b461fc62787bea44" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:Ms4Ov3gCw+VwCx7UTIqYHs2kxvo= sha256:ZAY43UoRzXMaMglVM2739G+wRO/2gtb7K7I21EJzp98= sha1:vYDXh/dbAsvPIqwsIJ4LIYobsxU= sha256:Oo0xuYPJb3UrOo8Rm0QU9JTN48tfG9D9c0gvyvnTbag= In-Reply-To: <86ece2kppv.fsf@linuxsc.com> Content-Language: en-US