Find the largest number in a list

Assignment Help Basic Computer Science
Reference no: EM131302246

1. Write and test a recursive function max to find the largest number in a list. The max is the larger of the first item and the max of all the other items.

2. Computer scientists and mathematicians often use numbering systems other than base 10. Write a program that allows a user to enter a number and a base and then prints out the digits of the number in the new base. Use a recursive function baseConversion(num,base) to print the digits.

Hint: Consider base 10. To get the rightmost digit of a base 10 number, simply look at the remainder after dividing by 10. For example, 153%10 is 3. To get the remaining digits, you repeat the process on 15, which is just 153/10. This same process works for any base. The only problem is that we get the digits in reverse order (right to left).

Write a recursive function that first prints the digits of num//base and then prints the last digit, namely num%base. You should put a space between successive digits, since bases greater than 10 will print out with multi-character digits. For example, baseConversion(245, 16) should print 15 5.

Reference no: EM131302246

Questions Cloud

Market value of the house-mortgage : A person has a net asset of $1 million, including a $300,000 net equity of a house (market value of the house – mortgage). Specifically, the house has a market value of $600,000 including $400,000 for the structure and $200,000 for the land, and a mo..
Provides a good overview of cost volume profit analysis : PowerPoint discussing CVP - Provides a good overview of Cost Volume Profit analysis, the various equations that you can use, and how to use it. Some examples are provided showing how to use the CVP Calculator.
Find coefficient of correlation between los and age : Provide the following descriptive statistics for gender: mean, median, mode, standard deviation, range. Find the coefficient of correlation between LOS and age of the patient. Interpret this value
Total ocean freight chargeable : A consignment of 5 cases each case measuring 2.45 x 1.20 x 1.35 Meters each weighing 3850 kilos has to be shipped from Chennai, Sydney, Australia. What will be the total ocean freight chargeable, if the liner rate is USD 85.00 w/m?
Find the largest number in a list : Computer scientists and mathematicians often use numbering systems other than base 10. Write a program that allows a user to enter a number and a base and then prints out the digits of the number in the new base. Use a recursive function baseConve..
Derive the lpe model for the limiter : Derive the LPE model for the limiter given and plot A versus f(A). Note that the Fourier integral will have to be evaluated using numerical integration procedures.
Types of immigrants better for america : 1. Is it good or bad that immigrants are willing to work for less? Why? 2. Are some types of immigrants better for America than others? Why? 3. What are the differences in the effects of illegal vs. legal immigration?
Simulate the band pass and the lpe models : Simulate the band pass and the LPE models and compare the simulated power levels with the computed power levels. Do this for at least three different sampling rates and compare the results.
Write a summary on human resources management : Write a summary on Human Resources Management and Summary of the Recommended Action Plan of Major Tasks, Persons or Departments Accountable, Time to Complete,Metrics for Evaluating the Results of the Transformation,Risks of Not Implementing the Chang..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Given the three goals of relational database design

Given the three goals of relational database design

  How would you decide between the two vendors’ products

The two products are very evenly matched on other key factors, such as performance, features, reliability, and support costs. How would you decide between the two vendors' products?

  Explain who is the story''s principle character

Explain who is the story's principle character in "The Possibility of Evil"?

  What is the new matrix of transition probabilities

Suppose that ∗ is eliminated from the output alphabet by merging it with 1. That is, whenever ∗ is received, it is read as 1 (this amounts to a coin flip with a very unfair coin). What is the new matrix of transition probabilities? Is the channel ..

  The debate between utilizing paper or plastic in the retail

The debate between utilizing paper or plastic in the retail market has and will always be around. The majority of grocery stores offer you the choice of paper or plastic, and some stores are even moving towards a more environmental friendly reusable ..

  What is a divided difference table and how is it constructed

State one advantage and two disadvantages of using the monomial basis for polynomial interpolation

  Justify the statement that the sample mean may be calculated

Justify the statement that the sample mean of Eq. (12.40) may be calculated from the iterative formula of Eq. (12.42).

  Find the number of steps per revolution.

If a given stepper motor has a step angle of 5 degrees, find the number of steps per     Revolution.

  Write an application that displays a crystal report

Write an application that displays a Crystal Report

  Principles of information systems security

For this exercise, you are going to start with this site: http://botlab.org. BotLab is a platform at the University of Washington that continually monitors and analyzes the behavior of spam-oriented botnets.

  A company called fastcabs provides a taxi service to clients

Identify the functional dependencies that exist between the columns of the table in Figure 14.21 and identify the primary key and any alternate key(s) (if present) for the table.

  Discuss the factors that affect query decomposition

Discuss the factors that affect query decomposition.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd