Let n be a positive integer and let MaxCrossing(n) be a function that returns the maximum number of line crossings that you can create by drawing n straight lines.  Write down a recursive formula for MaxCrossing(n) and analyze the time complexity of the corresponding recursive algorithm.  You must write a formal recursive formula including the base case and general recursive step.   Note: if n=1, there is 0 crossing, if n = 2, there is 1 crossing, if n = 3, there are 3 crossings (not only 2) if n = 4, there are 6 crossings (not only 3) if n = 5, there are 10 crossings, etc.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 17PE
icon
Related questions
Question

Let n be a positive integer and let MaxCrossing(n) be a function that returns the maximum number of line crossings that you can create by drawing n straight lines.  Write down a recursive formula for MaxCrossing(n) and analyze the time complexity of the corresponding recursive algorithm You must write a formal recursive formula including the base case and general recursive step.

 

Note:

if n=1, there is 0 crossing,

if n = 2, there is 1 crossing,

if n = 3, there are 3 crossings (not only 2)

if n = 4, there are 6 crossings (not only 3)

if n = 5, there are 10 crossings,

etc.

Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning