void top_view(Node* root) { if (root == NULL) return; print_left(root->left); cout << root->data << " "; print_right(root->right); }
void print_root(int size){ int height_of_root = size / 3; int i; for(i = 0; i < height_of_root; i++) { print_left(1,size,0); printf(" |\n"); } }
void rec_print_leaf_2(int height, int size){ if (height == size){ return; }else { print_left(height,size,1); print_body(height,size); printf("\\\n"); rec_print_leaf_2(height+1, size); } }
//----------------------------------------------------------------------------------------------------- void K3NGdisplay::print_left_padded(char * print_string,int y,int padding){ char workstring[WORK_STRING_SIZE] = ""; strcpy(workstring,print_string); for (int x = 0;(x < padding) && (strlen(workstring) < (WORK_STRING_SIZE-1));x++){ strcat(workstring," "); } print_left(workstring,y); }
void print_left(Node* left) { if (left == NULL) return; print_left(left->left); cout << left->data << " "; }