Article View: comp.lang.c
Article #83Re: AVL tree insertion - programming exercise
From: David Brown
Date: Fri, 09 Oct 2026 14:05
Date: Fri, 09 Oct 2026 14:05
124 lines
7070 bytes
7070 bytes
On 09/10/2026 14:38, Dan Cross wrote: > In article <11aaimc$n0f0$2@dont-email.me>, > David Brown <david.brown@hesbynett.no> wrote: >> On 09/10/2026 12:43, bart wrote: >>> [snip] >>> This 'MIX' language was something that astonished me even then. Not only >>> was it assembly that would totally obscure whatever algorithm was being >>> expressed, but it was a weird made-up assembly with unusual byte and >>> word sizes. >> >> Indeed. When I first saw it, I was familiar with several 8-bit >> assemblies (6502, Z80, 8085) and some 32-bit ARM assembly, and had read >> books on the 68000 family and MIPS. MIX was, to me, absurd. To be >> fair, the computer world was not nearly as consolidated in 1962, but I'm >> sure it looked fairly odd even by the standards of the time. > > If one were coming from the world of early 1960s mainframes, it > would perhaps be less astonishing. It would undoubtedly have been less astonishing in 1968 (when the first book was published) than in 1991 (when I first saw it), but I would have thought that even people familiar with 1960's mainframes would see it as strange to use a limited and highly specific artificial assembly that matched poorly with existing systems. I am sure people were already familiar with the pain of converting code written in assembly for one system into assembly for a very different system - the only advantage of the MIX code was that it was equally useless to everyone, and favoured no one! > >>> I understand that more recent editions use an updated 'MMIX' language: >>> now the registers are 64 bits, and there's a lot more of them. This is >>> still like publishing a book of algorithms using ARM64 assembly to >>> express them. >> >> Yes, this strikes me as even more absurd. It's just re-doing the >> previous mistake in a slightly less bad way. > > Unfortunately, he is quite adamant about this. He truly > believes that the best way to understand how an algorithm works > on a computer is to see it at the instruction level. > Then he could easily have invented a machine that is powerful enough for the details not to matter, and not need describing. The number and size of registers should not matter in any way for understanding algorithms. >>> It's not clear what he had against HLLs; perhaps he thought an actual >>> HLL would soon be superseded? Then pseudo-code should have been used. >> >> Real HLL's were around at the time - FORTRAN and ALGOL, or possibly >> LISP, would have been appropriate choices in the days before small >> letters were invented. Or he could have made a simple HLL pseudo-code >> for the purpose - things like unlimited sized integers and unlimited >> memory sizes would have made sense. > > The criticism of TAOCP is valid. It is not a book for workaday > programmers; it is an academic reference. The real value is in > the mathematical treatment and historical/bibliographic notes, > not the presentation of code in assembler. Agreed. > > Other books exist that are better references for most people; > certainly for most programmers: > > * "Introduction to Algorithms" by Cormen, Leiserson, Rivest, > and Stein is a standard. > * Sedgewick's books in C, simply titled, "Algorithms" are pretty > good, though his code style is slightly idiosyncratic. Now in > its 4th Edition, he has switched to Java and taken on a > coauthor (Kevin Wayne). > * "Algorithms", by Dasgupta, Papadimitriou, and Vazirani is a > wonderful book that, I think, strikes a nice balance between > formality and utility. > * I am rather partial to Skiena's work, "The Algorithm Design > Manual." > * "Data Structures and Their Algorithms" by Lewis and Denenberg > is a bit dated, but very accessible; examples are presented in > a Pascal-like pseudocode. > * "Data Structures and Algorithms" by Aho, Hopcroft, and Ullman > is a nice book. Be careful not to confuse it with Aho and > Ullman's, "The Design and Analysis of Computer Algorithms", > however; the latter is far denser and intended for academics > studying the fundamental properties of algorithms. > * "Algorithms + Data Structures = Programs" and the later > revision, "Algorithms & Data Structures", by Wirth, are > similarly dated, but still very nice. > * "Purely Functional Data Structures", by Okasaki; I include > this just because I think that it is fun. > My bookshelves are too scattered for me to easily see what I have. But I am not convinced that books are good references at all these days, for most purposes. They are, however, still good for study if you are doing courses or really learning a subject. > Of course, more specialized texts exist for specific problem > domains, programming paradigms, etc; books on string algorithms, > mutual exclusion protocols for concurrent programs, etc, are all > available, though not general. Yes. > > Did Knuth err using MIX and then MMIX for TAOCP? Perhaps; I do > think that neither Fortran nor Lisp would have been appropriate > choices; Algol perhaps. Other authors around that time or > slightly later either adopt a more mathematics-inspired > pseudonotation (Dijkstra; Hoare) algolish pseudo-code (Aho et > al), or a language of their own design (Wirth). > As Hoare was the head of department when I was at university, and therefore very influential in how we were taught, I am of course partial to his style of notation and think that would have been the best choice! > Knuth is a wonderful object of study, but I do not recommend it. > Agreed.
Technical Details
Message-ID:
<11aasbg$r60s$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> <11aa8vb$jk93$1@dont-email.me> <11aaggn$mu6q$1@dont-email.me> <11aaimc$n0f0$2@dont-email.me> <11aan7c$ki0$1@reader2.panix.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: David Brown <david.brown@hesbynett.no> Newsgroups: comp.lang.c Subject: Re: AVL tree insertion - programming exercise Date: Fri, 9 Oct 2026 16:05:36 +0200 Organization: A noiseless patient Spider Lines: 124 Message-ID: <11aasbg$r60s$1@dont-email.me> References: <86ece2kppv.fsf@linuxsc.com> <11aa8vb$jk93$1@dont-email.me> <11aaggn$mu6q$1@dont-email.me> <11aaimc$n0f0$2@dont-email.me> <11aan7c$ki0$1@reader2.panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 09 Oct 2026 14:05:37 +0000 (UTC) Injection-Info: dont-email.me; logging-data="890908"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/s1Xr5wSM4hZXA8IkuJYyFKZ7FCdIdTJk="; posting-host="e4f5a948a55ca956d08d1b630ba49c87" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:5/fVuD8JGUUwPd+mIl/YjWPXlhM= sha256:9xSLcfpyyBcEnMLsVygWLKxYSG873DtGnU6gZmzkaCs= sha1:eaEtoBMFnEgGtSjoOfhQLsQc7Gc= sha256:BDKtfm7SroPUSmyrBx/K6Q2fZMODWh9W4g6JeNz98Bk= In-Reply-To: <11aan7c$ki0$1@reader2.panix.com> Content-Language: en-GB, nb-NO