SE250:lab-7:jhor053

From Marks Wiki
Jump to navigation Jump to search

Task 1

Compiling the code was fun as it is very gnu specific and not ansi C so yeah cracked out the gcc and viola it runs.

Getting used to the tree kinda worked just took a bit of time.

Task 2

In order 4627531

> ins 4
4 (*)

> ins 6
4 (*)
  6

> ins 2
  2
4 (*)
  6

> ins 7
  2
4 (*)
  6
    7

> ins 5
  2
4 (*)
    5
  6
    7

> ins 3
  2
    3
4 (*)
    5
  6
    7

> ins 1
    1
  2
    3
4 (*)
    5
  6
    7

with the balance command gives:

> balance
    1
  2
    3
4 (*)
    5
  6
    7

This is a bit odd tree but thats the way the program adds it together :S

Task 3

> skew
1 (*)
  2
    3
      4
        5
          6
            7

> rl
  1 (*)
2
  3
    4
      5
        6
          7

Well i can see that it prints out post skewing and rotating left that it is different its as if it forced a shift left then balance.

Task 4

Task 5

Task 6

Task 7

Task 8

Conclusion