CS recursion

¡Supera tus tareas y exámenes ahora con Quizwiz!

Base case

The ____ is at least one case in which a problem can be solved without recursion

Recursive

A method that calls itself is a ____ method

5

Given the following code that uses recursion to find the factorial of a number, if n=5: Private static int factorial(int n) { If(n==0) Return 1; Else Return n*factorial(n-1); }

Depth of recursion

In a recursive program, the number of times a method calls itself is known as the ______

if (n==0) return 1;

In the following code that uses recursion to find the factorial of a number, what is the base case? Private static int(factorial n) { If(n==0) Return 1; Else Return n*factorial(n-1); }

the array must be sorted

To use recursion for a binary search, what is required before the search can proceed?

All of these

Which of the following problem can be solved recursively?


Conjuntos de estudio relacionados

Geology Lab: Topographic Maps and Profiles

View Set

The Endocrine System Practice Questions

View Set

Test 2: Chapter 6 Analyzing the Audience

View Set

20th Century Final Exam Dr. Green Covenant College

View Set

Pharmacology Chapter 10 "Antibercular Drugs"

View Set

Ap Psychology Cognition and Memory

View Set

r and k selection, communities, and ecosystems

View Set