Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: K&R2, Binar...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 9 Topic 26175 of 26972
Post > Topic >>

Re: K&R2, Binary-Tree, section 6.5

by Ben Pfaff <blp@[EMAIL PROTECTED] > May 13, 2008 at 10:15 AM

arnuld <sunrise@[EMAIL PROTECTED]
> writes:

>> On Mon, 12 May 2008 09:17:46 -0700, Ben Pfaff wrote:
>
>> I don't see how you get a balance factor of -2 from that tree.  I
>> see a balance factor of -1:
>> 
>>                              now
>>                           /       \
>>         ^               is         the           ^
>>         |             /   \       /   \          |
>> height  |          for    men    of    time      |  height
>>   4     |         /   \           \    /    \    |    3
>>         |      all   good      party  their  to  V
>>         |     /   \
>>         V   aid   come
>> 
>> The right child of "now" has height 3.  The left child of "now"
>> has height 4.  The difference is -1.
>
>
> I thought you don't count the nodes with single-child but I was wrong.
> Now it has a balance factor of -1 but cab I call it an AVL tree ?

No, because "is" has a balance factor of -2 (1 minus 3).
-- 
char a[]="\n .CJacehknorstu";int putchar(int);int main(void){unsigned long
b[]
={0x67dffdff,0x9aa9aa6a,0xa77ffda9,0x7da6aa6a,0xa67f6aaa,0xaa9aa9f6,0x11f6},*p
=b,i=24;for(;p+=!*p;*p/=4)switch(0[p]&3)case 0:{return
0;for(p--;i--;i--)case+
2:{i++;if(i)break;else default:continue;if(0)case
1:putchar(a[i&15]);break;}}}
 




 9 Posts in Topic:
K&R2, Binary-Tree, section 6.5
arnuld <sunrise@[EMAIL  2008-05-12 11:44:18 
Re: K&R2, Binary-Tree, section 6.5
arnuld <sunrise@[EMAIL  2008-05-12 12:49:00 
Re: K&R2, Binary-Tree, section 6.5
Ben Pfaff <blp@[EMAIL   2008-05-12 09:17:46 
Re: K&R2, Binary-Tree, section 6.5
arnuld <sunrise@[EMAIL  2008-05-13 21:13:11 
Re: K&R2, Binary-Tree, section 6.5
Ben Pfaff <blp@[EMAIL   2008-05-13 10:15:01 
Re: K&R2, Binary-Tree, section 6.5
arnuld <sunrise@[EMAIL  2008-05-15 10:28:52 
Re: K&R2, Binary-Tree, section 6.5
Ben Pfaff <blp@[EMAIL   2008-05-15 08:37:23 
Re: K&R2, Binary-Tree, section 6.5
arnuld <sunrise@[EMAIL  2008-05-13 21:15:23 
Re: K&R2, Binary-Tree, section 6.5
Richard Heathfield <rj  2008-05-13 05:08:40 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 16:16:21 CDT 2008.