Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello, Could any one please answer the following questions. 1.) Describe a recur

ID: 3609503 • Letter: H

Question

Hello, Could any one please answer the following questions. 1.) Describe a recursive algorithm that counts the number ofnodes in a singly linked list. 2.) Describe a linearly recursive algorithm for finding theminimum element in an n - element array. Please reply asp. Thank you Hello, Could any one please answer the following questions. 1.) Describe a recursive algorithm that counts the number ofnodes in a singly linked list. 2.) Describe a linearly recursive algorithm for finding theminimum element in an n - element array. Please reply asp. Thank you

Explanation / Answer

Input : Node

Ouput: count

Algorithm CountNodes( Node n , intcount )

{

if( n ==NULL)               //there is no node

return;

if (count == -1)           //If it is the first node

count=1;

else

count = count+1;           //increment the count

call CountNode( NextElement(n) ,count);

Ouput: min

Algorithm MinNodes( Node n , int min )

{

call minNode( NextElement(n) ,min);

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote