buffet
This commit is contained in:
parent
9693133143
commit
87a8c88581
@ -18,8 +18,8 @@ struct tree* read_tree(){
|
|||||||
buffer[x-1]='\0';
|
buffer[x-1]='\0';
|
||||||
|
|
||||||
assert(r);
|
assert(r);
|
||||||
|
|
||||||
if(buffer[0] != '\0'){
|
if(buffer[0] != '\0'){
|
||||||
|
|
||||||
struct tree* node = calloc(1,sizeof(struct tree));
|
struct tree* node = calloc(1,sizeof(struct tree));
|
||||||
memcpy(node->value, buffer,50);
|
memcpy(node->value, buffer,50);
|
||||||
if(buffer[0] != '*'){
|
if(buffer[0] != '*'){
|
||||||
@ -29,11 +29,12 @@ struct tree* read_tree(){
|
|||||||
if(node->right == NULL){
|
if(node->right == NULL){
|
||||||
node->right = read_tree();
|
node->right = read_tree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(node->left != NULL && node->right != NULL){
|
//if(node->left != NULL && node->right != NULL){
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
struct tree* search(struct tree* this){
|
struct tree* search(struct tree* this){
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ struct tree* search(struct tree* this){
|
|||||||
int x = strlen(buffer);
|
int x = strlen(buffer);
|
||||||
buffer[x-1]='\0';
|
buffer[x-1]='\0';
|
||||||
memcpy(buffer, this->value, 50); */
|
memcpy(buffer, this->value, 50); */
|
||||||
if(this != NULL){
|
if(this->left != NULL && this->right != NULL){
|
||||||
if(c == 'a'){
|
if(c == 'a'){
|
||||||
printf("%s\n", this->value);
|
printf("%s\n", this->value);
|
||||||
this->left = search(this->left);
|
this->left = search(this->left);
|
||||||
|
Loading…
Reference in New Issue
Block a user