473,473 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

interesting question about tree

Hi can anyone print a binary tree in the way that it will look like a
tree?

so it will be like this:

50
/ \
30 70
/ \ \
20 35 100

can we do this in c without using gui as we can do this in java by
using gui?

thanks

May 3 '06 #1
3 1364

compboy wrote:
Hi can anyone print a binary tree in the way that it will look like a
tree?
I'm sure someone can.
so it will be like this:

50
/ \
30 70
/ \ \
20 35 100
Yes, definitelly possible using just plain <stdio.h> functionality.
can we do this in c without using gui as we can do this in java by
using gui?


And your C question was (asking for someone to do it all for you does
not count)?

May 3 '06 #2
Are you sure we can do this by just using plain <stdio.h>?
How do you do that then?
is it by pushing all the output to a stack or a queue and use it later
on?
Does anyone have an idea to help me to solve this problem?

Thanks.
Vladimir Oka wrote:
compboy wrote:
Hi can anyone print a binary tree in the way that it will look like a
tree?


I'm sure someone can.
so it will be like this:

50
/ \
30 70
/ \ \
20 35 100


Yes, definitelly possible using just plain <stdio.h> functionality.
can we do this in c without using gui as we can do this in java by
using gui?


And your C question was (asking for someone to do it all for you does
not count)?


May 4 '06 #3
"compboy" <co********@gmail.com> writes:

[drawing trees]
Are you sure we can do this by just using plain <stdio.h>?
How do you do that then?
is it by pushing all the output to a stack or a queue and use it later
on?
Does anyone have an idea to help me to solve this problem?


It's not that difficult. Just build up a "canvas" in memory and
then output it line by line when you've finished. See, e.g. the
tree drawing program in GNU libavl.
--
Ben Pfaff
email: bl*@cs.stanford.edu
web: http://benpfaff.org
May 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tarique Jawed | last post by:
Alright I needed some help regarding a removal of a binary search tree. Yes its for a class, and yes I have tried working on it on my own, so no patronizing please. I have most of the code working,...
16
by: makko | last post by:
Hello, anyone know how to writre a program that take a commandline formula and prints the calculated result? example; $program 1+(2x3(3/2))-8 reagrds; Makkko
2
by: Sky | last post by:
Basically, I'm stumped on how to translate something I wrote in PHP to ASP.NET, and I'm having a hard time figuring out what is right way to do it now... The scenario in PHP was as follows: I...
4
by: Today's Mulan | last post by:
I guess this is new, at least to people who don't know about this, like me, please be prepared to give me a satifying answer, so please tell me how the compiler "knows" variable "i" as in a...
27
by: Chad | last post by:
The problem is: Write a recursive version of the function reverse(s), which reverses the string s in place. In "The C Answer Book", Second Edition, near the bottom of page 95, the authors say...
90
by: John Salerno | last post by:
I'm a little confused. Why doesn't s evaluate to True in the first part, but it does in the second? Is the first statement something different? False print 'hi' hi Thanks.
3
by: asianmuscle | last post by:
Hi I am relearning datastructure... but got kinda stuck in a basic delete node operation. what it does is to delete the first node it finds when the item is equal the input item. the end result is...
2
by: xianwei | last post by:
First, typedef struct pair { Node *parent; Node *child; } Pair; static Pair SeekItem(cosnt Item *pI, const Tree *pTree) { Pair look;
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.