Write a recursive function called sumover
that has one argument n, which is an
unsigned integer. The function returns a
double value, which is the sum of the reciprocals of
the first n positive integers. (The reciprocal of x is
the fraction 1/x.) For example, sumover(1) returns
1.0 (which is 1/1); sumover(2) returns 1.5 (which
is 1/1 + 1/2); sumover(3) returns approximately
1.833 (which is 1/1 + 1/2 + 1/3). Define
sumover(0) to be zero. Do not use any local variables
in your function.
Submit output for when n=290
Implement the recursive function isPal(), which determines whether a string str is a simple palindrome. A simple palindrome is a string consisting entirely of the characters a-z that reads the same forward and backward. For instance, the upcoming are palindromes: dad, level, mom, madamimadam, gohangasalamiimalasagnahog. Use the following declaration of isPal(): bool isPal (const string& str, int startIndex, int endIndex); It returns true when the substring in the index range [startIndex, endIndex) is a palindrome. The conditions are Stopping Condition: Result is true when startIndex >= endIndex -1 Result is false when str[startIndex] != str[endIndex-1] Recursive Step: Determine whether the substring of the str in the index range [startIndex+1, endIndex-1] is a palindrome
Screenshot of code1:

Output:




code:
#include<iostream>
using namespace std;
double sumover(unsigned int n)
{
double s=0.0;
for(int i=1;i<=n;i++)
s+=(1/(1.0*i));
return s;
}
int main()
{
unsigned int n;
cout<<"Enter n: ";
cin>>n;
cout<<"sum is: "<<sumover(n);
}
Screenshot of code2:

Output:

code:
#include<iostream>
using namespace std;
bool isPal (const string& str, int startIndex, int
endIndex)
{
for(int i=startIndex;i<=endIndex;i++)
{
if(str[i]!=str[endIndex-i])
return false;
}
return true;
}
int main()
{
string s;
int start,end;
cout<<"Enter string: ";
cin>>s;
cout<<"Enter start and end index: ";
cin>>start>>end;
bool k=isPal(s,start,end);
if(k==1)
cout<<"TRUE";
else
cout<<"FALSE";
}
//please upvote.
Write a recursive function called sumover that has one argument n, which is an unsigned integer....
Please read the problem carefully and answer the 2 questions
below
code:
/*****************************************************************
* Program: palindrome.c
*
* Purpose: implements a recursive function for determining
* if a string is a palindrome
*
* Authors: Steven R. Vegdahl, Tammy VanDeGrift, Martin Cenek
*
*****************************************************************/
#include
#include
#include
/*****************************************************************
* is_palindrome - determines whether a string of characters is a
palindrome
*
* calling sequence:
* result = is_palindrome(str, first_index,
last_index)
*
* parameters -
* str - the string to test
* first_index -...
***************Fix code recursive function #include <iostream> #include <cctype> #include <string> using namespace std; void printUsageInfo(string executableName) { cout << "Usage: " << executableName << " [-c] [-s] string ... " << endl; cout << " -c: turn on case sensitivity" << endl; cout << " -s: turn off ignoring spaces" << endl; exit(1); //prints program usage message in case no strings were found at command line } string tolower(string str) { for(unsigned int i = 0; i < str.length(); i++)...
PLEASE USE MATLAB
This is a basic problem that illustrates the concept of strings. A palidrome is a string of characters that is read the same forwards as it is backwards. For example, racecar' is a palindrome; reversing the order of the characters leaves the string unchanged. Write a otherwise. function called isPalindrome that accepts one input and returns one output. The input str is a string of characters, and the output is 1 if str is a palindrome, For...
1. DOES A DIGIT APPEAR IN AN INTEGER, Write a recursive function appears(n,i) that returns true if the digit i appears in the positive (base 10) integer n, false if it does not in c++. ex. Enter a positive integer: 54321 Enter a digit: 7 The digit 7 does NOT appear in the integer 54321. 2. IS AN INPUT STRING A PALINDROME? A palindrome is a string in which the letters are the same in both directions, disregarding capitalization and...
Write a function check palindrome, which takes a string x as argument and which returns True if x is a palindrome, and False otherwise. A palindrome is a word that reads the same backwards as forwards (like for example “racecar”). Your function should be recursive (i.e. call itself) and proceed as follows. 1. If x is a string of length 0 or 1 return True. 2. If the rst and the last letter of x are di erent, return False....
1.) Write a recursive function named isPalindrome that will take a single string as an argument and determine if the argument is a palindrome. The function must return True if the argument is a palindrome, False otherwise. Recall that any string is a palindrome if its first and last characters are the same and the rest of it is also a palindrome (therefore, a single character is a palindrome): 2.) Consider a text file named samplestrings.txt that contains a collection...
Write a function palcheck (char word II) which takes a C-style string word (or a C++ string word if you wish) and returns or false depending on whether or not the string is a palindrome. (A palindrome is a string which reads the same backwards and forwards. Some classic example of palindromes are radar, racecar, toot, deed, bib, civic, redder and madam.) Use your function from part (a) in a complete C++ program which, for each small letter 'a' through...
For this assignment, you will create a program that tests a string to see if it is a palindrome. A palindrome is a string such as “madam”, “radar”, “dad”, and “I”, that reads the same forwards and backwards. The empty string is regarded as a palindrome. Write a recursive function: bool isPalindrome(string str, int lower, int upper) that returns true if and only if the part of the string str in positions lower through upper (inclusive at both ends) is...
public static int countCharacter(String str, char c) { // This recursive method takes a String and a char as parameters and // returns the number of times the char appears in the String. You may // use the function charAt(int i) described below to test if a single // character of the input String matches the input char. // For example, countCharacter(“bobbie”, ‘b’) would return back 3, while // countCharacter(“xyzzy”, ‘y’) would return back 2. // Must be a RECURSIVE...
Write a recursive version of the palindrome function. It should ignore non-letters and case. (Hint: use isalpha() .) The function signature is: def is_palindrome(s): """ ------------------------------------------------------- Recursively determines if s is a palindrome. Ignores non-letters and case. Use: palindrome = is_palindrome(s) ------------------------------------------------------- Parameters: s - a string (str) Returns: palindrome - True if s is a palindrome, False otherwise (boolean) ------------------------------------------------------- """