1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ololo11 [35]
3 years ago
8

For the recursive method below, list the base case and the recursive statement, then show your work for solving a call to the re

cur() method using any parameter value 10 or greater.
public static int recur(int n)
{
if(n < 1)
{
return 3;
}
else
{
return recur(n / 5) + 2;
}
}

Computers and Technology
1 answer:
Paul [167]3 years ago
3 0

Answer:

(a): The base case: if(n<1)

(b): The recursive statement: recur(n / 5)

(c): Parameter 10 returns 7

Explanation:

Given

The above code segment

Solving (a): The base case:

The base case is that, which is used to stop the recursion. i.e. when the condition of the base case is true, the function is stopped.

In the given code, the base case is:

<em>if(n<1)</em>

Solving (b): The recursive statement:

The recursive statement is the statement within the function which calls the function.

In the given code, the recursive statement is:

<em> recur(n / 5)</em>

<em />

Solving (c): A call to recur() using 10

The base case is first tested

if (n < 1); This is false because 10 > 1

So, the recursive statement is executed

<em>recur(n/5) +2=> recur(10/5)+2 => recur(2)+2</em>

2 is passed to the function, and it returns 2

if (n < 1); This is false because 2 > 1

So, the recursive statement is executed

<em>recur(n/5) +2=> recur(2/5)+2 => recur(0)+2</em>

2 is passed to the function, and it returns 2

<em />

if (n < 1); This is true because 0 < 1

This returns 3

So, the following sum is returned

Returned values = 2 + 2 + 3

Returned values = 7

You might be interested in
Assume that a kernel is launched with 1000 thread blocks each of which has 512 threads. If a variable is declared as a shared me
Alex

Answer:

The answer to this question is the option "B".  

Explanation:

In this question, the answer is option B which is 1,000 because the kernel is a central part of an operating system. kernel manages the computer and the hardware operations. most especially memory and CPU time. It also sheared a memory variable is allocated to thread blocks. That's why the answer to this question is 1,000.

7 0
3 years ago
Which statement accurately compares the restart at 1 and continue numbering featured of word
Andrews [41]

Answer: the continue numbering feature can be used to maintain the numbering order in a list and the restart at 1 feature can be used to make a new list

Explanation:

7 0
3 years ago
Read 2 more answers
what is the largest possible number of internal nodes in a redblack tree with black height k? what is the smallest possiblenumbe
Elina [12.6K]

Answer:

A Red Black Tree is a type of self-balancing(BST) in this tree ,each node is red or black colored. The red black tree meets all the properties of the binary search tree, but some additional properties have been added to a Red Black Tree.

A Red-Black tree's height is O(Logn) where (n is the tree's amount of nodes).

In a red-black tree with black height k

The maximum number of internal nodes is 2^{2k} -1.

The smallest possible number is 2^{k} -1.

7 0
3 years ago
According to the mil-std-6016 what are the requirements for information to be passed between and among joint forces and organiza
mixas84 [53]

Based on  mil-std-6016, the requirements for information to be passed between and among joint forces, along with the technical interfaces is called Joint Tactical Operations (JTO) Procedural Handbook.

<h3>What is Joint Tactical Operations (JTO) Procedural Handbook?</h3>

This is known to be a book that contains all  the provisions that is needed by system operators along with some technical parameters and tactical procedures.

It is often used  for the exchange of near real-time data through TDL and it is known to be set up to function on console in the time of joint service operations and exercises.

Learn more about military from

brainly.com/question/525279

6 0
1 year ago
Write the steps for renaming an existing folder​
vekshin1

Answer:

Rename a file or folder

Explanation:

1.Right-click on the item and select Rename, or select the file and press F2 .

2.Type the new name and press Enter or click Rename.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Which view In a presentation program displays you’re slides in full screen modes ?
    8·2 answers
  • An employee who interacts with customers regarding the nature of their car problems, rather than actually working on the vehicle
    12·2 answers
  • _____ _____ deals with the definitions properties of mathematical models of computation.
    8·1 answer
  • A network administrator for a small company is contemplating how to scale the network over the next three years to accommodate p
    13·1 answer
  • Given an integer n and an array a of length n, your task is to apply the following mutation to an: Array a mutates into a new ar
    5·1 answer
  • Do debit cards offer the highest level of fraud pretection?
    10·1 answer
  • in java Write a program with total change amount in pennies as an integer input, and output the change using the fewest coins, o
    13·1 answer
  • Clarissa is a computer programming consultant. When a client states that they have an extremely complex programming task, which
    10·2 answers
  • Write a program that reads in an integer, and breaks it into a sequence of individual digits. Display each digit on a separate l
    14·1 answer
  • A profit of ₹ 1581 is to be divided amongst three partner P,Q and R in ratio 1/3:1/2:1/5.theshareof R will be?​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!