Advertisement
Guest User

Untitled

a guest
Jan 21st, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1.  
  2. import javax.xml.soap.Node;
  3. import java.util.Stack;
  4.  
  5. public class Homework1 {
  6.  
  7. public static void main(String[] args) {
  8. // Begin of arguments input sample
  9. if (args.length > 0) {
  10. String input = args[0];
  11.  
  12. Stack inputstack = new Stack();
  13.  
  14. Node root = null;
  15. for(int i=0;i<input.length();i++){
  16. char a = input.charAt(i);
  17. System.out.println(input.charAt(i));
  18. if(Character.isDigit(input.charAt(i))==true) {
  19. inputstack.push(new Node(a + ""));
  20. }else {
  21. int first,second,oparand;
  22. Node parentNode = new Node(a + "");
  23. parentNode.left = (Node) inputstack.pop();
  24. parentNode.right = (Node) inputstack.pop();
  25.  
  26.  
  27. inputstack.push(parentNode);
  28.  
  29. }
  30. }
  31.  
  32. }
  33. }
  34. public static int calculate(Node n){
  35.  
  36. }
  37. public static Node infix(Node n){
  38.  
  39. }
  40. public static String inorder(Node n){
  41.  
  42. }
  43. public class tree{
  44. public class Node{
  45. char key;
  46. Node left;
  47. Node right;
  48. Node parent;
  49. }
  50. }
  51. }
  52.  
  53. // End of arguments input sample
  54.  
  55. // TODO: Implement your project here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement