Wednesday, August 15, 2007

Write a C program to find the depth or height of a tree.

Here is some C code to get the height of the three


tree_height(mynode *p)
{
if(p==NULL)return(0);
if(p->left){h1=tree_height(p->left);}
if(p=>right){h2=tree_height(p->right);}
return(max(h1,h2)+1);
}



The degree of the leaf is zero. The degree of a tree is the max of its element degrees. A binary tree of height n, h > 0, has at least h and at most (2^h -1) elements in it. The height of a binary tree that contains n, n>0, elements is at most n and atleast log(n+1) to the base 2.

Log(n+1) to the base 2 = h

n = (2^h - 1)

222 comments:

«Oldest   ‹Older   201 – 222 of 222
ツイッター said...

新時代突入!ツイッターで始まる出逢い…ここでしかできない出逢いが新しい風を巻き起こす!!素敵な巡りあわせを体験していこう!

SMチェッカー said...

あなたの秘められたSM度がわかるSMチェッカー!簡単な質問に答えるだけで自分の隠された部分が分かります!みんなで試してみよう

モバゲー said...

今やモバゲーは押しも押されもせぬ人気SNS!当然出 会いを求めてる人も多い!そこで男女が出 逢えるコミュニティーが誕生!ここなら友達、恋人が簡単にできちゃいますよ

モバゲー said...

もう夏休みも終わりに近づき、この夏最後の思い出を作りたいと焦ってる方が、モバゲーのコミュニティーに書かれてましたよ!!折角なんで夏の思い出作りに協力して自分も美味しい思いをしてみるのはどうですか?大手スポンサーサイトが付いてるので全部タダですよ

グリー said...

最近はどこのSNSサイトも規制ばっかりで、ちょっと出 合いに関して書き込みするとアク禁食らうけど、夏休み終盤に差し掛かり色々なサイトを調べた結果、グリーだけはどうも規制が緩んでるみたいです。今がチャンスの時期ですよ

ツイッター said...

ツイッターで出 合 いを求めるのです。気の合う異性と交流して楽しいひと時をお過ごしください。登録無料で使えるので気軽さは100点満点!

Unknown said...

Thanks for the info. It is very helpful.
RegardsEducational site
Get jobs info at Educational site

Unknown said...

It is nice to see this blog with full of interview questions with good order . It helped me a lot to prepare exams. Hadoop Interview Questions

Unknown said...
This comment has been removed by the author.
Unknown said...

Myself reginald sanjay pal. Thanks for share beneficial information.

asitbangalorereviews said...

Good collection...
Core Java Interview Questions and Answers

Advanced Java Interview Questions and Answers

c++ interview questions and answers

Mysql Interview Questions and Answers

Testing Questions and Answers

Martin said...

Hello my friend! I would like to tell you that this write-up is awesome, great written and include almost all important info. I recently came to know about http:www.yesiamhired.com, their Interview Tips are very effective.
Interview Tips

Unknown said...

Thank you for making this site very interesting! Keep going! You're doing very well
online interview guide

Unknown said...

Wow, what a fantastic post. The best post around. Thumbs up
online interview guide

Unknown said...

thnks for this sharing the lot of interview tips

interview tips
job interview tips
tips for job interviews
tips for an interview
tips interview
interview questions
interview questions and answers

Unknown said...

Thank you for sharing such a useful information. It was so useful. Please visit
Intrview

Unknown said...

Very Useful information that i have found. donot stopand Please keep updating us..... Thanks

Hannah Baker said...

Thank you for sharing useful information about Interview. Here I prefer some more useful information aboutInterview Tips for Job

Machine Learning training in Noida said...

Awesome, Very nice Blog, Thanks for sharing helpful information.
Jobs in Noida for Freshers

bhanupratap said...

Thank your valuable content.we are very thankful to you.one of the recommended blog.which is very useful to new learners and professionals.content is very useful for hadoop learners


Best ASP.NET MVC Online Training Institute
Best Spring Online Training Institute
Best Devops Online Training Institute
Best Datascience Online Training Institute
Best Oracle Online Training Institute
Best AWS Online Training Institute
Best AngularJS Online Training Institute
Best C-language Online Training Institute


Get Now a Best Health Insurance policy - Best Health Insurance Advisor said...

Very informative article!
If you are looking for Health Insurance & Other Insurance Plan. Get all types of life insurance plans like term, life, pension, child plans etc. Compare & Buy Online Best health insurance policy in India. We are Providing a various insurance plans at a minimal premium. Compare Online Insurance Plan & Find with Benefits by top Health Insurance companies.

Credit Loan Solution said...


Do you need Personal Loan?
Business Cash Loan?
Unsecured Loan
Fast and Simple Loan?
Quick Application Process?
Approvals within 24-72 Hours?
No Hidden Fees Loan?
Funding in less than 1 Week?
Get unsecured working capital?
Contact Us At : gaincreditloan1@gmail.com
Whatsapps +1-(551) 356-3808 (call/WhatsApp)

«Oldest ‹Older   201 – 222 of 222   Newer› Newest»