CSES - Order of additions

Using the class TreeSet of the preceding task, implement a test where the elements 1n1 \dots n are added to the tree. The test has two parts, both with n=1000n=1000.

In the first test, the elements are added in the order of their value, and in the second test, they are added in a random order. In both tests, measure the height of the tree after the additions.

In this task, you get a point automatically, when you report the results and supply the code you used, and press the submit button.

Height in test 1:

Height in test 2:

The code you used:

How do you explain the difference in the tests?