Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void wypiszDrzewo() {
- int p = 0;
- while (Math.pow(2, p) <= tab.length) {
- p++;
- }
- p--;
- for (int i = 0; i < p + 1; i++) {
- int k = p - i;
- if (k != 0) {
- for (int b = 0; b <= Math.pow(2, k) - 2; b++) {
- System.out.print(" ");
- }
- //System.out.print(" ");
- }
- //System.out.print(" ");
- for (int j = (int) Math.pow(2, i) - 1; j < (int) Math.pow(2, i + 1) - 1; j++) {
- if (j < tab.length) {
- if (tab[j] < 10) {
- System.out.print(tab[j] + " ");
- } else {
- System.out.print(tab[j]);
- }
- for (int m = 0; m < Math.pow(2, p - i + 1); m++) {
- System.out.print(" ");
- }
- for (int b = 0; b <= Math.pow(2, k) - 2; b++) {
- System.out.print(" ");
- }
- }
- }
- System.out.println("");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement