Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Rudolf
/
huffman
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f5fba026
authored
Nov 16, 2016
by
Rudolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve print tree graph
parent
b66df99a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
12 deletions
print_helper.c
print_helper.c
View file @
f5fba026
...
...
@@ -49,27 +49,24 @@ void print_tree(struct tree *parent)
{
int
level
=
1
;
while
(
parent
->
left
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
level
;
i
++
)
{
printf
(
" "
);
}
if
(
parent
->
right
)
if
(
parent
->
right
)
{
for
(
int
i
=
0
;
i
<
level
;
i
++
)
printf
(
" "
);
print_char
(
parent
->
right
->
ch
);
}
for
(
int
i
=
0
;
i
<
level
-
1
;
i
++
)
{
printf
(
" "
);
}
printf
(
"o
\n
"
);
for
(
int
i
=
0
;
i
<
level
;
i
++
)
{
printf
(
" "
);
}
if
(
parent
->
left
&&
parent
->
left
->
ch
!=
0
)
if
(
parent
->
left
&&
parent
->
left
->
ch
!=
0
)
{
for
(
int
i
=
0
;
i
<
level
;
i
++
)
printf
(
" "
);
print_char
(
parent
->
left
->
ch
);
else
printf
(
"o
\n
"
);
}
level
+=
2
;
level
+=
1
;
parent
=
parent
->
left
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment