Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. public class PrefixTree {
  2.     private PrefixTree left;
  3.     private PrefixTree rigth;
  4.     private char character;
  5.  
  6.     public PrefixTree(PrefixTree left, PrefixTree rigth, char character) {
  7.         this.left = left;
  8.         this.rigth = rigth;
  9.         this.character = character;
  10.     }
  11.  
  12.     public void print() {
  13.         System.out.print(this.character);
  14.         if (this.left != null) {
  15.             this.left.print();
  16.         }
  17.         if (this.rigth != null) {
  18.             this.rigth.print();
  19.         }
  20.     }
  21.  
  22.     public static void main(String[] args) {
  23.         // 1. Распечатать дерево из задания
  24.     }  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement