Skip to content

Commit 9c7e226

Browse files
author
Raven G. Duran
committed
Fixed zero value not printing and Key Count Indexing
1 parent 0780758 commit 9c7e226

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

btree.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ void inOrder(struct node *root){
226226
int i;
227227
if (root == NULL) return;
228228
else {
229-
for (i = 0; i < root->keyCount; i++){ // -1 since left and right key of every data box
229+
for (i = 0; i < root->keyCount - 1; i++){ // -1 since left and right key of every data box
230230
inOrder(root->keys[i]);
231-
if((void*)root->value[i] != NULL) printf("~%d~\n",root->value[i]);
231+
printf("~%d~\n",root->value[i]);
232232
}
233233
}
234234
}
@@ -237,8 +237,8 @@ void levelOrder(struct node *root){
237237
int i;
238238
if (root == NULL) return;
239239
else {
240-
for (i = 0; i < root->keyCount; i++){ // -1 since left and right key of every data box
241-
if((void*)root->value[i] != NULL || root->value[i] != (int)NULL) printf("%d ",root->value[i]);
240+
for (i = 0; i < root->keyCount - 1; i++){ // -1 since left and right key of every data box
241+
printf("%d ",root->value[i]);
242242
}
243243
printf(" ");
244244
if (root->parent == NULL) printf("\n");

btree.exe

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)