Question: Suppose you are to write a recursive function to calculate the area of a triangle shown as follows, where the area of each [ ]

Suppose you are to write a recursive function to calculate the "area" of a triangle shown as follows, where the area of each [] square is 1:
[][][][][][][][][]
[][][][][][][]
[][][][][]
[][][]
[]
Assume the base of the triangle (top edge) always has an odd number of [] squares, and each subsequent line has two fewer squares (and hence the triangle always ends with a point that has just one [] square). What could be an appropriate base case for a recursive function that calculates the area of a triangle of this kind?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!