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

  Find out probability at any given time user transmitting

Assume there are 20 users. Determine probability that at any given time, exactly n users are transmitting simultaneously. Determine the probability that there are 11 or more users transmitting simultaneously.

  Create a dtd for a small xml data set

Create a DTD for a small XML data set drawn from the Stanford course catalog. There are multiple departments, each with a department chair.

  Write a program that tests a sequence has an at repeat

Write a program that tests to see whether a sequence has an AT repeat - Return a message to the user whether or not an AT repeat exits in the sequence. Use at least one subroutine.

  Write pseudocode-read in data file containing student name

Write a pseudocode to do the following Read in data file containing student names, ID number, and gender into an array.

  Initialize elements of array with even integers

declare an array called values of type unsigned int with 5 elements. Initialize the elements of the array with the even integers from 2 to 10.

  Demonstrate that you can read and understand code

What will the code output when run - What are individualScores, bonusScore, baseScore, and teamScore? What do you think the difference is between the keywords let and var?

  English sentences into statements of predicate calculus

Translate the following English sentences into statements of predicate calculus. All programmers enjoy discrete mathematics. Some integers are not odd

  Xhtml page to display current date time in client-s computer

Create the XHTML page which will display current date time in client's computer. Use document.write method in immediate script.

  Create the object-oriented design for dvd collection

Create the object-oriented design for system which keeps tracks of your CD and DVD collection. Recognize each of the classes, associated data, and operations for classes.

  Developing an adt with overloaded operators

The purpose of this assignment is to practice developing an ADT with overloaded operators and separate compilation. For this project we will be developing an ADT for integers.

  Program that asks user how many automobiles are to describe

Write a program that asks the user how many automobiles are to be described, and for each automobile it inputs the user's selection of make and color. Then it outputs color and make.

  What is a data flow diagram

Define what is meant by a process in a process model. How should a process be named? What information about a process should be stored in the CASE repository?

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