- with 10 nodes, give one example of an unbalanced binary tree and
one example of a balanced binary tree
- what is the advantage of having a balanced binary tree over an
unbalanced tree?
- number your nodes, then give the order in which nodes will be
visited by a depth-first-search
- explain the differences between traversing the tree pre-order, in-
order and post-order 8 3307
In article <11************ **********@h2g2 000hsg.googlegr oups.com>,
<n.******@gmail .comwrote:
- with 10 nodes, give one example of an unbalanced binary tree and one example of a balanced binary tree
Example of a balanced binary tree: [IMAGE]
Example of an unbalanced binary tree: [IMAGE]
- what is the advantage of having a balanced binary tree over an unbalanced tree?
A balanced tree won't fall over when you stop holding it.
- number your nodes, then give the order in which nodes will be visited by a depth-first-search
42, pi, 17, e, 105, 69, i, sqrt(2), 3, -1.
- explain the differences between traversing the tree pre-order, in- order and post-order
The order you traverse it in is different.
DYODH.
dave
--
Dave Vandervies dj******@csclub .uwaterloo.ca
Hey, I can beat him on the Impressive But Useless certificates thing.
I have a PhD.
--Dan Holdsworth in the scary devil monastery n.******@gmail. com wrote:
- with 10 nodes, give one example of an unbalanced binary tree and
one example of a balanced binary tree
Unbalanced tree: AB,C'K:D'EH:FJ: G: (notation adapted
from Knuth, TAOCP 2.3.3 equation 3)
To balance the tree, put another one on the other pan.
- what is the advantage of having a balanced binary tree over an
unbalanced tree?
Easier access to firewood. When the next high wind topples
the unbalanced tree, the balanced tree that's over it will fall
at the same time and save you the work of cutting it down.
- number your nodes, then give the order in which nodes will be
visited by a depth-first-search
Numbers: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Depth-first order: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
- explain the differences between traversing the tree pre-order, in-
order and post-order
With pre-order, the pizza is ready when you arrive at the
shop and you needn't wait. With in-order, you may need to pay
a restaurant tax to eat the pizza on the premises. With post-
order, the pizza reaches you three to five business days later
and is unpalatable.
--
Eric Sosman es*****@acm-dot-org.invalid n.******@gmail. com wrote:
- with 10 nodes, give one example of an unbalanced binary tree and
one example of a balanced binary tree
- what is the advantage of having a balanced binary tree over an
unbalanced tree?
- number your nodes, then give the order in which nodes will be
visited by a depth-first-search
- explain the differences between traversing the tree pre-order, in-
order and post-order
I think you should have posted to comp.lazy.domyh omework, since (a)
this is homework; having someone else do it for you misses the point;
(b) it's off-topic, since it isn't about C at all.
--
Not A Number, A Free Hedgehog
Meaning precedes definition.
In article <6N************ ****@nnrp.ca.mc i.com!nnrp1.uun et.ca>,
Clever Monkey <sp******@cleve rmonkey.org.INV ALIDwrote:
>n.******@gmail .com wrote:
> - what is the advantage of having a balanced binary tree over an unbalanced tree?
A balanced tree will not fall over in a storm, as long as the wind blows evenly from all directions.
But the wind in most storms doesn't blow evenly from all directions.
If you're going for storm tolerance, you really want an unbalanced tree,
but the problem with that is that every time the wind changes you have
to go out and re-unbalance it for the new wind direction.
dave
--
Dave Vandervies dj******@csclub .uwaterloo.ca
And there was nothing insulting about it. Some people would rather
take being called a ``normal person'' as an insult.
--Nils Goesche in comp.lang.c
In article <mc************ *************** ***@comcast.com >,
Eric Sosman <es*****@acm-dot-org.invalidwrot e:
>n.******@gmail .com wrote:
> - with 10 nodes, give one example of an unbalanced binary tree and one example of a balanced binary tree
Unbalanced tree: AB,C'K:D'EH:FJ: G: (notation adapted from Knuth, TAOCP 2.3.3 equation 3)
Unless you have a different edition than I do (3rd), I think you meant
equation 4.
dave
--
Dave Vandervies dj******@csclub .uwaterloo.ca
The DS 9000 is a conforming implementation.
The DS 9001 is so cleverly designed that experts can't agree whether it
is conforming or not! --Christian Bau in comp.lang.c
Dave Vandervies wrote On 05/04/07 16:08,:
In article <mc************ *************** ***@comcast.com >,
Eric Sosman <es*****@acm-dot-org.invalidwrot e:
>>n.******@gmai l.com wrote:
>> - with 10 nodes, give one example of an unbalanced binary tree and one example of a balanced binary tree
Unbalanced tree: AB,C'K:D'EH:FJ: G: (notation adapted
>>from Knuth, TAOCP 2.3.3 equation 3)
Unless you have a different edition than I do (3rd), I think you meant
equation 4.
The renumbering was part of the adaptation.
-- Er*********@sun .com
Dave Vandervies wrote:
In article <6N************ ****@nnrp.ca.mc i.com!nnrp1.uun et.ca>,
Clever Monkey <sp******@cleve rmonkey.org.INV ALIDwrote:
>n.******@gmail. com wrote:
>> - what is the advantage of having a balanced binary tree over an unbalanced tree?
A balanced tree will not fall over in a storm, as long as the wind blows evenly from all directions.
But the wind in most storms doesn't blow evenly from all directions.
If you're going for storm tolerance, you really want an unbalanced tree,
but the problem with that is that every time the wind changes you have
to go out and re-unbalance it for the new wind direction.
So true. I think I'm barking up the wrong tree here. We better leaf
this alone for while, or we might end up branching off into the wrong
direction. If I twig onto anything else, I'll let you know, but I think
this conversation will not bear any new fruit. Either that, or I'm the
fall guy and can't see the tree for the forest.
--
clvrmnky
Direct replies will be blacklisted. Replace "spamtrap" with my name to
contact me directly. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: abhrajit |
last post by:
I'm looking for a C/C++/Java library to create a balanced binary tree
data structure given a set of leaf nodes as input. A leaf node should
never become an interior node.
So if I wish to create a tree that will have a,b,c & d as leaf nodes -
this tree will contain nodes other than a,b,c & d as interior nodes:
e.g.
x
/ \
|
by: Rasmus |
last post by:
Hi.
As partly novice in python I would like a piece of advise of how to
implement (binary) trees the best way?
Thanks in advance,
Rasmus
PS: Due to heavy spam reception (20.000+/week), I use a fake sender address.
|
by: JC |
last post by:
Hi,
I'm looking for some help on Binary trees, in particular levels, heights
etc.
I need to find the levels of a tree, I also need to determine the minimum,
maximum and average leaf levels.
Any help would be greatly appreciated...
Thank you,
|
by: Jerry Khoo |
last post by:
hello, everybody, i am kinda new here, nice to meet u all. Now, i am
> cs students and are now facing difficult problems in understanding
> what a binary tree is, how it works, and the algorithm to display,
> arrange, find, delete the leaf node in binary tree.
>
> I hope that anyone with expereince in building binary tree could help
> me in explaining the binary tree functions, and give a sample code of
> the whole picture behind the...
|
by: Foodbank |
last post by:
Hi all,
I'm trying to do a binary search and collect some stats from a text
file in order to compare the processing times of this program (binary
searching) versus an old program using linked lists. I'm totally new
to binary searches by the way. Can anyone help me with the commented
sections below? Much of the code such as functions and printfs has
already been completed. Any help is greatly appreciated.
Thanks,
| |
by: ptrSriram |
last post by:
Can someone help me with an algorithm to merge two binary search trees.
One method I thought of was to flatten both the trees into sorted
lists(inorder traversal),merge those two sorted lists, and build a
binary search tree from the new list.
But this seems to be expensive in terms of space. Can this be done more
efficiently ?
Please help me.
|
by: sudharsan |
last post by:
please gimme the logic to merge two binary search trees?I mean which
node has to be the root node of the new binary tree??
Thanks in advance
|
by: free2cric |
last post by:
Hi,
I have a single link list which is sorted.
structure of which is like
typedef struct mylist
{
int num;
struct mylist *next;
|
by: pyguy |
last post by:
Hi all,
I am running into a conceptual glitch in implementing a simple binary tree class. My insertion and printing (sorting) seems to be ok, but when I search the tree, my find method isn't doing what I thought it should.
Here is the output of running my tests:
>python -i trees.py
**********************************************************************
File "trees.py", line 70, in __main__.BinaryTree.find
Failed example:
|
by: Vinodh |
last post by:
Started reading about Binary Trees and got the following questions in
mind. Please help.
Definition of a Binary Tree from "Data Structures using C and C++ by
Tanenbaum" goes like this,
"A binary tree is a finite set of elements that is either empty or is
partitioned into three disjoint subsets. The first subset contains a
single element called the 'Root' of the tree. The other two subsets
are themselves binary trees, called the 'Left'...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |