Write a recursive function which accepts a string

Assignment Help Programming Languages
Reference no: EM131110465

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

1b. 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.)

1c. 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.

2. 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: EM131110465

Questions Cloud

Calculate the us dollar translated figures : Calculate the U.S. dollar-translated figures for the two ending time periods, assuming that between December 31, 2112, and December 31, 2113, the euro has appreciated against the U.S. dollar by6%.
Explain the relationship among the gospels : How would you explain the relationship among the Gospels to someone who was not familiar with the Bible? Which Gospel do you think offers the best overview of the gospel of Jesus Christ? Why?
Define these three categories : Define these three categories, and use a two-dimensional figure to illustrate how the splitting is performed.
Required assignment two-analyzing risk : In this assignment, you will write an executive summary analyzing the exchange risks, country risks, and political risks the company executive team needs to be aware of in building a manufacturing facility in Brazil.
Write a recursive function which accepts a string : 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.
How this sample of data points is nonlinearly transformed : The example given in Fig. 5.1b depicts a spherically separable dictomy Assume that the four data points outside the separating surface lie on a circle and that the only data point inside lies at the center of the separating surface
Examine delusions more closely and weigh : Think about some examples of delusions that you may have encountered or witnessed in your recent experiences or that have been depicted in literature, plays, and film.
Calculate the first fundamental form of s : Let S be the surface parametrized by X: U → R3, where X(u, v)=(u, v, u2 - v2), Calculate the first fundamental form of S in terms of (u, v)
Defend your stance with research application : Do you think CMG is a successful company? Defend your stance with research application. How do CMG's resources support the company's competitive position?

Reviews

Write a Review

Programming Languages Questions & Answers

  Constructors need to be declared for each class.

Hi, I need helping figuring out the following questions. I need to identify the following statements as either true or false. If an answer is true, I need to explain why and, where appropriate, provide an example. If the answer is false, I also ne..

  Create the logic for a program that accepts an annual salary

Create the logic for a program that accepts an annual salary as input pass the salary to a method that calculate the highest monthly housing payment the user can afford assuming that the year's total payment is no more than 25 percent of the annua..

  Give greedy algorithm to get all n people across bridge

Give a greedy algorithm to get all these n people across the bridge in a fastest way. Describe the algorithm briefly. Prove the correctness.

  Necessary documentation for a mock meeting for the project

Create the necessary documentation for a mock meeting for the project. Create a sample progress report for the key stakeholders in the project.

  Game of life

The game is played on the rectangular board. Each square at time T could contain 1 that indicates the presence of the organism (life) or 0 that indicates the absence of the organism (death).

  Program to read employee information into array of objects

Consider a program that will read employee information into an array of objects, sort the array by employee identification number, write out the sorted array.

  Write program to operate as point of sale application

Write down program which will operate as the point of sale (POS) application at carpet retailer. Carpet will be sold by square yard. Padding will be sold by square yard.

  Javascript function to verify fields if cookie is added

JavaScript function has verified that all the required fields have been filled, cookie is added to user's computer. If same user tries to fill out form second time.

  Type of control used in programming

Loop statements are another type of control used in programming that allow programmers to interrupt the structural flow of a program.

  2 steps of handling data and invoking procedures

2 steps of handling data and invoking procedures2 steps of handling data and invoking procedures

  Use that function to output each line of the countdown

Write code to create a web page that uses a JavaScript program to output a NASA style count down:

  Design application that gets customer account data

Design an application that gets customer account data that includes an account number, customer name, and balance due.

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