Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- class Node
- public int frequency; // the frequency of this tree
- public char data;
- public Node left, right;
- */
- void decode(String S ,Node root){
- Node temp = root;
- for( int i = 0; i < S.length(); i++)
- {
- if(temp.data != '\0')
- {
- System.out.println(temp.data);
- temp = root;
- }
- else
- {
- switch(S.charAt(i))
- {
- case '0':
- System.out.println("moving left");
- temp = temp.left;
- break;
- case '1':
- System.out.println("moving right");
- temp = temp.right;
- break;
- default:
- break;
- }
- }
- }
- }
- //void decodeHelper(Node)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement