skuskaa
This commit is contained in:
		
							parent
							
								
									12973fc249
								
							
						
					
					
						commit
						af003ab578
					
				
							
								
								
									
										21
									
								
								a3/binary_search_tree.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								a3/binary_search_tree.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | |||||||
|  | #include <stdlib.h> | ||||||
|  | #include <string.h> | ||||||
|  | #include <stdio.h> | ||||||
|  | #include "binary_search_tree.h" | ||||||
|  | 
 | ||||||
|  | node_t *build_tree(int *tree_data, size_t tree_data_len){ | ||||||
|  | 
 | ||||||
|  |     node_t *koren = (node_t *)malloc(sizeof(node_t)); | ||||||
|  | 
 | ||||||
|  |     if(tree_data == NULL || tree_data_len == NULL){ | ||||||
|  |         return 0; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     if(tree_data != NULL && tree_data_len != NULL){ | ||||||
|  |         koren->data = tree_data[0]; | ||||||
|  |         koren->left = tree_data[0]; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return koren; | ||||||
|  | } | ||||||
|  | 
 | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user