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

  Analysis summarizing the wireless design

Provide a 7 to 10 page analysis summarizing the wireless design to the executive management team. The summary should effectively allow the senior management to understand the organization security requirements and make the appropriate decisions..

  How do you write a program that prompts a professor

ow do you write a program that prompts a professor to imput grades for five different courses for ten students

  What is the resulting ciphertext

Consider WEP for 802.11. Suppose that the data is 10101010 and the keystream is 11110111. What is the resulting ciphertext?

  Common information security threats

Common Information Security Threats

  Assess an organisation information system

Journal task is to assess an Organisation Information System, and write a report. The assessment should focus on the various components of business systems

  Write a thesis statement and outlineon the technology

Technology is technology is running at an exponentially increasing rate. This has been really good in the medial field but bad to some people who can't keep up. Technology has helped to improve medical care for people, for instance, during the las..

  Write a code fragment to load the numbers in addresses

Write a code fragment to load the numbers in addresses

  Z-tranforms and convolution in matlab

Do problem 2c and 2d from homework of week 5 in Matlab.(c) and express it in positive powers of z. When computing the value of trigonometric functions, keep in mind that the arguments are always in radians and not in degrees.

  Estimate maximum aggregate i-o transfer rate in system

Estimate the maximum aggregate I/O transfer rate in this system. Hint: Only one device at a time can be serviced on a selector channel.

  Calculate the oil production rate

Calculate the oil production rate and calculate the well skin effect - Calculate oil rates of two wells in an undersaturated oil reservoir using generalized Vogel's equation.

  Use wireshark tool to capture packets use wireshark tool to

use wireshark tool to capture packets when you download lecture 1 from the coit20229 course webpage. before you

  Find the greatest common divisor (gcd) of two integers

the greatest common divisor (GCD) of two integers is the largest integer that evenly divides each of the two numbers.Write method Gcd that returns the greatest common divisor of two integers.

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