Watch a Christmas tree print in stars: two centred tiers from one nested loop, then a one-star trunk.
About this algorithm
The Christmas tree stacks two centred triangles and stands them on a one-star trunk. It is the pyramid rule used twice, with the second tier starting narrower so the tree has a visible step.
Try it after the pyramid. The only new idea is shifting the row count so a second triangle starts over, which is how you stack any number of tiers.
The tree is 8 rows by 9 columns at every size: the slider does not change it.
Rows 0 to 2 print a star when |j - 4| <= i: one, three, then five stars.
Rows 3 to 6 print a star when |j - 4| <= i - 2: three, five, seven, then nine stars.
Row 7 prints a star only at j = 4.
Stars per row: 1, 3, 5, 3, 5, 7, 9, 1, which is 34 stars and 38 spaces in 72 cells.
Each tier is the pyramid rule with its row count shifted back so it starts narrower than the tier above ended. A third tier would use i - 4 for its half-width on the rows below the second. Keep the widest row of the last tier at the full width of the grid, and the trunk lands in the middle column without any extra work.
The trunk is the one row that is not a triangle. Testing j === 4 on the last row is the simplest way to draw it; a wider trunk is |j - 4| <= 1 on one or two rows.
Time: every one of the 72 cells gets one test. Space: the test needs only i, j and the half-width for the row.