public void morrisTraverse(TreeNode root) {

		while (root != null) {
			if (root.getLeft() == null) {
				System.out.println(root.getData());
				root = root.getRight();
			} else {
				TreeNode ptr = root.getLeft();

				while (ptr.getRight() != null && ptr.getRight() != root)
					ptr = ptr.getRight();

				if (ptr.getRight() == null) {
					ptr.setRight(root);
					root = root.getLeft();
				}

				else {
					ptr.setRight(null);
					System.out.println(root.getData());
					root = root.getRight();
				}
			}
		}
	}