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

  What are modes in file

1) What are modes in file? 2) Write the syntax to open a file. 3) What is the significance of fclose() function?

  Evaluating the entire expression

Make whatever assumptions you wish about the number of available main-memory buffers and the sizes of relations mentioned in E and F.

  Write a select statement that returns four columns

Write a Select statement that returns four columns from the Invoices table, named Number, Total, Credits, and Balance

  How would you avoid the pitfalls posed by the inequalities

What is mental accounting and how does it impact consumer decision making?

  Describe database elements primary key foreign key metadata

Describe a database and its various elements. Define Primary Key, foreign key, and metadata.

  Use in order to convert database tables

Describe the steps that you would use in order to convert database tables to the First Normal Form, the Second Normal Form, and the Third Normal Form.Provide one (1) example that is relevant to a college environment that illustrates reasons for..

  Why method external object able modify attributes of object

n a method that accepts an object as an argument, writing code that accidentally modifies the object. When a reference variable is passed as an argument to a method, the method has access to the object that the variable references.

  Develop an effective research plan considering context

Develop an effective research plan considering context, research questions, sources, timeline, and larger implications for writing a formal research report

  Program to implement the alternative strategy

a. Write a program to implement the alternative strategy. b. If the output polynomial has about O(M + N) terms, what is the running time of both methods?

  Write a class called checkingaccount

Write a class called CheckingAccount that has the following fields and methods.

  Write sql statements to create the corresponding relations

Consider the university database from Exercise 2.3 and the ER diagram you designed. Write SQL statements to create the corresponding relations and capture as many of the constraints as possible. If you cannot capture some constraints, explain why.

  Describe the different types of database requests and

Describe the different types of database requests and transactions.  Explain the need for the two-phase commit protocol. Then describe the two phases.  What is the objective of query optimization functions? To which transparency feature are the query..

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