binary tree? | | |
is there any algorithm to create a breadth-first order binary tree? | | | | re: binary tree?
"pc_newbie" <ay@computermail.net> wrote in message
news:3f6d24dc$1_1@news.iprimus.com.au...[color=blue]
> is there any algorithm to create a breadth-first order binary tree?[/color]
Yes. If I wanted one, I'd probably follow
the google-brick road.
-Mike | | | | re: binary tree?
Mike Wahler wrote:
[color=blue]
> "pc_newbie" <ay@computermail.net> wrote in message
> news:3f6d24dc$1_1@news.iprimus.com.au...
>[color=green]
>>is there any algorithm to create a breadth-first order binary tree?[/color]
>
>
> Yes. If I wanted one, I'd probably follow
> the google-brick road.
>
> -Mike
>
>[/color]
where can i find it? | | | | re: binary tree?
pc_newbie wrote:[color=blue]
> Mike Wahler wrote:
>[color=green]
>> "pc_newbie" <ay@computermail.net> wrote in message
>> news:3f6d24dc$1_1@news.iprimus.com.au...
>>[color=darkred]
>>> is there any algorithm to create a breadth-first order binary tree?[/color]
>>
>>
>>
>> Yes. If I wanted one, I'd probably follow
>> the google-brick road.
>>
>> -Mike
>>
>>[/color]
> where can i find it?[/color]
Bookmark this link: http://www.google.com
--
Morris Dovey
West Des Moines, Iowa USA
C links at http://www.iedu.com/c | | | | re: binary tree?
Morris Dovey wrote:[color=blue]
> pc_newbie wrote:
>[color=green]
>> Mike Wahler wrote:
>>[color=darkred]
>>> "pc_newbie" <ay@computermail.net> wrote in message
>>> news:3f6d24dc$1_1@news.iprimus.com.au...
>>>
>>>> is there any algorithm to create a breadth-first order binary tree?
>>>
>>>
>>>
>>>
>>> Yes. If I wanted one, I'd probably follow
>>> the google-brick road.
>>>
>>> -Mike
>>>
>>>[/color]
>> where can i find it?[/color]
>
>
> Bookmark this link:
>
> http://www.google.com
>[/color]
can't find any information about it yet | | | | re: binary tree?
pc_newbie writes:
[color=blue]
> Morris Dovey wrote:[color=green]
> > pc_newbie wrote:
> >[color=darkred]
> >> Mike Wahler wrote:
> >>
> >>> "pc_newbie" <ay@computermail.net> wrote in message
> >>> news:3f6d24dc$1_1@news.iprimus.com.au...
> >>>
> >>>> is there any algorithm to create a breadth-first order binary tree?
> >>>
> >>>
> >>>
> >>>
> >>> Yes. If I wanted one, I'd probably follow
> >>> the google-brick road.
> >>>
> >>> -Mike
> >>>
> >>>
> >> where can i find it?[/color]
> >
> >
> > Bookmark this link:
> >
> > http://www.google.com
> >[/color]
> can't find any information about it yet[/color]
Very few people that say "use google" have actually tried their advice in
the case at hand. It is just an adult's answer to "why is the sky blue,
daddy?". Look it up, kid. I can't be bothered. If there *is* an answer
it's probably on google, it doesn't follow that the answer can be found with
a reasonable expenditure of effort. Or that the questioner knows the right
buzz words to actually find the answer. You need a tool kit of jargon and
catchy phrases and a certain amount of experience to google successfully.
This may help. http://www.wikipedia.org/wiki/Breadth_first_recursion
Post any follow ups to comp.programming, this is the wrong newsgroup for
your question. | | | | re: binary tree?
pc_newbie wrote:
[color=blue]
> Morris Dovey wrote:
>[color=green]
>> pc_newbie wrote:
>>[color=darkred]
>>> Mike Wahler wrote:
>>>
>>>> "pc_newbie" <ay@computermail.net> wrote in message
>>>> news:3f6d24dc$1_1@news.iprimus.com.au...
>>>>
>>>>> is there any algorithm to create a breadth-first order binary tree?
>>>>
>>>> Yes. If I wanted one, I'd probably follow
>>>> the google-brick road.
>>>>
>>>> -Mike
>>>>
>>> where can i find it?[/color]
>>
>> Bookmark this link:
>>
>> http://www.google.com
>>[/color]
> can't find any information about it yet[/color]
My apologies. I should have provided more info.
[1] Go to http://www.google.com
[2] Run a search on "binary tree"
[3] Click on link "Search within these results"
[4] Run subsearch on "breadth-first"
[5] Puzzle out a new subsearch because 12300 results seem like
too much to read. 8-)
--
Morris Dovey
West Des Moines, Iowa USA
C links at http://www.iedu.com/c | | | | re: binary tree?
Morris Dovey writes:
[color=blue]
> [5] Puzzle out a new subsearch because 12300 results seem like
> too much to read. 8-)[/color]
Yes, that's the rub, what *is* the next step? Remember that the OP has used
up *all* his knowledge at this point. I have no desire to pursue this
particular example, this may yield a useful result at this point, it may
not. But I have been there many times in the past with similar problems
and the next step is far from clear. I know of no way of eliminating course
outlines, vu-graphs, and syllabuses from the list of hits. The cases where
I actually did this for myself were full of useless dreck. The best answer
is filtered through a human mind. Perhaps if he reposts as I suggested he
will still get a meaningful answer before the sun bloats up and kills us
all. | | | | re: binary tree?
pc_newbie wrote:
[color=blue]
> Mike Wahler wrote:[color=green]
>> Yes. If I wanted one, I'd probably follow
>> the google-brick road.[/color][/color]
[color=blue]
> where can i find it?[/color] www.google.com
--
Martin Ambuhl | | | | re: binary tree?
"osmium" <r124c4u102@comcast.net> wrote in message
news:bkkfoj$2lkjb$1@ID-179017.news.uni-berlin.de...[color=blue]
>
> Post any follow ups to comp.programming, this is the wrong newsgroup for
> your question.[/color]
Exactly. My reply was a (apparently too subtle)
indication of this.
-Mike | | | | re: binary tree?
On Sun, 21 Sep 2003 13:13:34 -0700, in comp.lang.c , "osmium"
<r124c4u102@comcast.net> wrote:
[color=blue]
>Morris Dovey writes:
>[color=green]
>> [5] Puzzle out a new subsearch because 12300 results seem like
>> too much to read. 8-)[/color]
>
>Yes, that's the rub, what *is* the next step?[/color]
a) random selection
b) start from the top.
Either seems reasonable.
[color=blue]
>Remember that the OP has used up *all* his knowledge at this point.[/color]
Then (and no offense to the OP) further use of the internet seems
highly unlikely to be useful. For is it not said "go not to the elves
for counsel, and also the internet, innit?" . Using the net for basic
understanding requires a high level of well, understanding, first....
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html> | | | | re: binary tree?
On Sun, 21 Sep 2003 10:23:53 -0700, in comp.lang.c , "osmium"
<r124c4u102@comcast.net> wrote:
[color=blue]
>
>Very few people that say "use google" have actually tried their advice in
>the case at hand.[/color]
I can. I almost always find the answer, be it "is suchandsuch a make
of children's building bricks compatible with lego" or "whats
ankylosing spondylitis and can you recover from it". (answers are yes
and no, in either order).
What is required is a bit of common sense, and some understanding of
googling. To get the latter, learn. To get the former..
FWIW My own search turned up seve ral relevant references in page 1,
including some code samples.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html> | | | | re: binary tree?
Mark McIntyre writes:
[color=blue][color=green]
> >Remember that the OP has used up *all* his knowledge at this point.[/color]
>
> Then (and no offense to the OP) further use of the internet seems
> highly unlikely to be useful.[/color]
Not at all. There are a great many things I can do if someone will open the
book up at the right page for me. But I will be damned if I know how to
*find* that page. I have no reason to believe I am unusual in that respect. | | | | re: binary tree?
osmium wrote:[color=blue]
> Morris Dovey writes:
>[color=green]
>> [5] Puzzle out a new subsearch because 12300 results seem
>> like too much to read. 8-)[/color]
>
> Yes, that's the rub, what *is* the next step?[/color]
<much snipped>
[color=blue]
> The best answer is filtered through a human mind.[/color]
Exactly so. My own next step was to do a subsearch on "C source"
(quoted) which reduced the number of entries substantially; but
reflected my own interests, rather than the OP's stated interest
(algorithms).
My rationale was that at least a subset of available algorithms
can be extracted from source codes; and that at least a rough
estimate of quality can be made by skimming each reference's C code.
[Somebody's Law: "Ninety percent of everything is crud."]
On the other hand, if the OP was looking for some in-depth
discussion (prose) dealing with "breadth-first order binary
trees" my approach would probably not be terribly productive.
--
Morris Dovey
West Des Moines, Iowa USA
C links at http://www.iedu.com/c | | | | re: binary tree?
Morris Dovey <mrdovey@iedu.com> writes:
[...][color=blue]
> [Somebody's Law: "Ninety percent of everything is crud."][/color]
Sturgeon's. (That's Theodore Sturgeon, the late science fiction
author.)
--
Keith Thompson (The_Other_Keith) kst@cts.com <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be" | | | | re: binary tree?
pc_newbie wrote:[color=blue]
> is there any algorithm to create a breadth-first order binary tree?
>[/color]
thanks a lot all guys | | | | re: binary tree?
pc_newbie wrote:
[color=blue]
> is there any algorithm to create a breadth-first order binary tree?
>[/color]
you all guys are misunderstanding what i asked, what i want is how to
create a breadth-first order binary, not to travel a binary tree with
breadth first order. but thanks a lot anyway, i should find the way by
myself.
that's what i want
1
2 3
4 5 6 7
normal binary is
4
3 5
1 2 6 7 | | | | re: binary tree?
"pc_newbie" <ay@computermail.net> wrote:[color=blue]
> that's what i want
> 1
> 2 3
> 4 5 6 7
>
> normal binary is
> 4
> 3 5
> 1 2 6 7[/color]
#include <stdio.h>
#include <stdlib.h>
struct tree {
int value;
struct tree *left;
struct tree *right;
};
struct tree *create(int start, int max)
{
struct tree *new = NULL;
/* If this node should exist: */
if(start < max)
{
/* First, create it: */
new = malloc(sizeof *new);
if(!new)
{
fprintf(stderr, "Error allocating memory\n");
exit(EXIT_FAILURE);
}
new->value = start;
/* Then create its children: */
new->left = create(start * 2, max);
new->right = create(start * 2 + 1, max);
}
return new;
}
Call it with create(1, 8) for your example tree.
C:\prog\c>gcc -std=c99 -pedantic -Wall -W -O2 bftree.c -o bftree
C:\prog\c>bftree 32
1
2 3
4 5 6 7
8 9 10 11 12 13 14 15
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
My tree pretty-printing routine is quite interesting.
--
Simon. | | | | re: binary tree?
pc_newbie wrote:[color=blue]
> pc_newbie wrote:
>[color=green]
> > is there any algorithm to create a breadth-first order binary
> > tree?
> >[/color]
> you all guys are misunderstanding what i asked, what i want is
> how to create a breadth-first order binary, not to travel a
> binary tree with breadth first order. but thanks a lot anyway,
> i should find the way by myself.
>
> that's what i want
> 1
> 2 3
> 4 5 6 7
>
> normal binary is
> 4
> 3 5
> 1 2 6 7[/color]
Now you have actually described your problem, assuming the digits
above are indexes of entry order and not keys. I have no idea
what you consider "normal binary".
BTW, your postings would be much more understandable if you used
upper case letters where appropriate, such as the start of
sentences or the pronoun I.
As others have pointed out, this is OT for c.l.c, but quite
topical for comp.programming. I have cross-posted this and set
follow-ups, so any further discussion should be there.
--
Replies should be to the newsgroup
Chuck Falconer, on vacation. | | | | re: binary tree?
Simon Biber wrote:
[color=blue]
> "pc_newbie" <ay@computermail.net> wrote:
>[color=green]
>>that's what i want
>> 1
>> 2 3
>> 4 5 6 7
>>
>>normal binary is
>> 4
>> 3 5
>> 1 2 6 7[/color]
>
>
> #include <stdio.h>
> #include <stdlib.h>
>
> struct tree {
> int value;
> struct tree *left;
> struct tree *right;
> };
>
> struct tree *create(int start, int max)
> {
> struct tree *new = NULL;
>
> /* If this node should exist: */
> if(start < max)
> {
> /* First, create it: */
> new = malloc(sizeof *new);
> if(!new)
> {
> fprintf(stderr, "Error allocating memory\n");
> exit(EXIT_FAILURE);
> }
> new->value = start;
>
> /* Then create its children: */
> new->left = create(start * 2, max);
> new->right = create(start * 2 + 1, max);
> }
> return new;
> }
>
> Call it with create(1, 8) for your example tree.
>
> C:\prog\c>gcc -std=c99 -pedantic -Wall -W -O2 bftree.c -o bftree
>
> C:\prog\c>bftree 32
> 1
> 2 3
> 4 5 6 7
> 8 9 10 11 12 13 14 15
> 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
>
> My tree pretty-printing routine is quite interesting.
>[/color]
Thank you very much :) it works very well |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,531 network members.
|