Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.programming Subject: Re: on an n-element heap and its nodes of height h Date: Tue, 19 Apr 2016 02:28:24 +0100 Organization: A noiseless patient Spider Lines: 42 Message-ID: <87r3e2jsjr.fsf@bsb.me.uk> References: <86h9ez2l43.fsf@toledo.com> <864may3mcl.fsf@toledo.com> <87y48aju20.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="8085"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bag3HMDIjkoQLUYybLNYgAgXNXufyiYE=" Cancel-Lock: sha1:6BqPZT2rYnmmgcdtisRARu4jTH0= sha1:ZUOndbHOL9xKLFAf1Tf5TmUY9zo= X-BSB-Auth: 1.028dabf658113d8f8813.20160419022824BST.87r3e2jsjr.fsf@bsb.me.uk Xref: csiph.com comp.programming:6522 Richard Heathfield writes: > On 19/04/16 01:55, Ben Bacarisse wrote: >> Richard Heathfield writes: >> > >> >>> Let's show it for h = 4: >>> >>> 1:...........*........... >>> 2:.....*...........*..... >>> 3:..*.....*.....*.....*.. >>> 4:.*.*...*.*...*.*...*.*. >>> >>> At level 4, we have 8 = 2^(4-1) nodes, not 16 = 2^4 nodes. >> >> Most people would call that a tree of height 3. I've never seen your >> counting used for tree height, but I have led a sheltered life. > > One can envisage nodes in a tree as if they were rooms in a building, > and the height is the number of storeys. h=4 > > One can envisage nodes in a tree as if they were posts in a fence, and > the height is the number of fence-rails you need. h=3 One could, but why would one? Why is that analogy better than others where height is usually a measured length? Or, more exactly, given that there is an established usage, are the benefits of your usage enough to outweigh the resulting confusion? At the moment I see no advantages at all. Do you use the same counting for depth? Does the root have depth 1? > Both make sense. I think my way makes more sense, but then I would, > wouldn't I? Starting out saying "no" is a bit strong then! Saying "There are two ways to measure the height and I'm using the less usual one" wouldn't have been so confrontational. -- Ben.