Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write scheme program (xyz.scm) [5 marks] Write a procedure called (palindrome? s) that takes a string s as argument and returns true (#t) if s

write scheme program (xyz.scm)
  1. [5 marks] Write a procedure called (palindrome? s) that takes a string s as argument and returns true (#t) if s is palindrome.
  2. [7 marks] A k-palindrome is a string that can be made into a palindrome by ignoring up to k characters. Write a procedure called (k-palindrome? s k) that takes a string s and a non-negative integer k as arguments and returns true if s is a k-palindrome. For example,

(k-palindrome? "tahcohcat" 2) -> #t

(k-palindrome? "tahcohcat" 1) -> #f

You may find the following built-in procedures useful for the above problems:

  • (string-length str) - returns the number of characters in a given string
  • (string-ref str i) - returns the character at a specified index in a given string
  • (substring str start [end]) - returns a substring of a given string between two indices [the ending index is opti

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis In Microsoft Excel

Authors: Alex Holloway

1st Edition

B0CCCPKTTX, 979-8852388452

More Books

Students also viewed these Databases questions

Question

List six habits that can help you become a more positive thinker.

Answered: 1 week ago