Question
Please send as PDF ZIP file after completing it. $100 for doing all steps correctly. A. Write a pseudo-code description for a method of finding
Please send as PDF ZIP file after completing it.
$100 for doing all steps correctly.
A. Write a pseudo-code description for a method of finding the smallest and largest numbers in an array of integers. Compare your pseudo-code to a Java method that would do the same thing.
B. Write a short Java program that outputs all of the possible strings formed using each of the characters c, a, t, d, o, and g exactly once.
C. Draw the recursion trace for the execution of the method PuzzleSolve(3, S, U) (Code Fragment 5.11), where S is empty and U = {a,b,c,d}.
D. Describe a fast recursive algorithm for reversing a singly linked list L, so that the ordering of the nodes becomes opposite to what it was before.
E. Describe a recursive algorithm for solving the Towers of Hanoi puzzle for an arbitrary n (see Creativity Exercise C-5.16 for more details).
F.Give a pseudo-code description for the O(n)-time algorithm for computing the power function, p(x,n). Draw the recursion trace of this algorithm to compute p(2,5).
7. Given a set A = {a1, a2, , an} of n integers, use pseudo-code to describe an efficient method of computing each of the partial sums sk = a1 + a2 + + ak for k = 1,2,,n. What is the running time for this method?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started