Write a non-recursive function vowels

Assignment Help Basic Computer Science
Reference no: EM13926746

Q1

a. Write a non-recursive function vowels() that accepts a character string and counts and returns the number of vowels (aeiou) in the string.

b. Write a recursive function rvowels() that accepts a character string and counts and returns the number of vowels (aeiou) in the string. This solution should not include any loops. A global variable for the counter is acceptable. (Hint: one possible solution is to "chop" the string down until you are left with a single character.)

c. Using the test string ‘this is a test to see if my program can accurately count the vowels' and the time operation described in the book on page 371 in the function timing, time the non-recursive solution and the recursive solution. Does this test provide any useable proof? Explain. Place both your functions into one file. Dropbox your Word document showing all code and output, along with your Python file. In the Word document, include your answer to the above question: Does this test provide any useable proof? Explain.

Q2. Write a recursive function which accepts a string and its length and determines if the string is a palindrome. A palindrome is a string that reads the same frontwards and backwards. Hint: compare the first character with the last character. Equal or not? Go from there.

Reference no: EM13926746

Questions Cloud

Confidence interval estimate for mean head circumference : Find a 95% confidence interval estimate for the mean head circumference of all two-moth old babies. What aspect of this problem is not realistic?
Minimum state finite automaton for the language : Find the minimum state finite automaton for the language specified by the finite automaton
Set theory-relations-functions and sequences : Look up a roulette wheel diagram. The following sets are defined:
Sets of data and explore ways of analyzing that data : we are going to look at sets of data and explore ways of analyzing that data so that conclusions can be made from that data. Now, it is possible to have a data set that has many as 100 data points or even 1000's of data points. We need to summa..
Write a non-recursive function vowels : Write a non-recursive function vowels() that accepts a character string and counts and returns the number of vowels (aeiou) in the string.
Present value of the hotel terminal value : Assume that the $450 million expense of building the hotel can be written off straight line over a 30-year period (the other $150 million is for the land which is not depreciable) and that the present value of the hotel's terminal value will be $2..
Chi-square goodness of fit test : Four different brands of a pain medication used for chronic back ailments were tested to see if the number of side effects for each brand were the same. The table below lists the results of the reported number of side effects for each brand of pa..
Business requirements driving the need for the system : The presentation must include the following: A full description of the new system, a description of its components, and the benefit it will provide to Riordan A discussion of the business requirements driving the need for the system A discussion o..
Css to create a navigation bar : What suggestions do you have for Karina as she plans to update the website using CSS? What advantages are there to using CSS to create a navigation bar for your website? List two advantages.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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