Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // trees.h
- // final-trial
- //
- // Created by Ahmed Omar on 5/27/14.
- // Copyright (c) 2014 Ahmed Omar. All rights reserved.
- //
- #ifndef final_trial_trees_h
- #define final_trial_trees_h
- #include <stdlib.h>
- #include <stdio.h>
- struct bin_tree {
- int id;
- char name[40];
- struct bin_tree * right, * left, *parent;
- };
- struct bin_tree_pointers {
- int id;
- char name[40];
- struct bin_tree_pointers* right, *left;
- };
- typedef struct bin_tree node_id;
- typedef struct bin_tree_pointers node_name;
- node_id* insert_id(node_id* tree, int id, char* name);
- node_id* insert_name(node_id* tree, int id, char* name);
- void insert(node_id** tree_id, node_id** tree_name, int id, char* name);
- node_id* search_id(node_id** tree, int id);
- //node_id *search_name(node_id** tree, char* name);
- void search_name(node_id* root , char *name , node_id* ptrarray[] , int*n)
- void search_id_2(node_id** tree, int id);
- void search_name_2(node_id** tree, char* name);
- node_id * min_value_node_id(node_id* node);
- node_id * min_value_node_name(node_id* node);
- node_id* delete_id(node_id* tree, int id);
- node_id* delete_name(node_id* tree, char* name, int c);
- //in this functions we will use delete_id and delete_name
- void del_id(node_id** tree_id, node_id** tree_name, int id);
- void del_name(node_id** tree_id, node_id** tree_name, char* name);
- void deltree(node_id* tree_id, node_id** tree_name);
- void print_preorder(node_id* tree,int c);
- void print_inorder(node_id* tree,int c);
- void print_postorder(node_id* tree, int c);
- /*void print_preorder(node_id* tree, int c);
- void print_inorder(node_id* tree, int c);
- void print_postorder(node_id* tree, int c);*/
- void reed_file_to_tree(node_id** tree_id, node_id** tree_name, char* file_name);
- void write_tree_to_file(node_id* tree_id, FILE* fp);
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement