43 views2 pages
School
Course
Professor
Notes - Stacks - The Mirror Problem
We have already used stacks check if brackets are properly balanced. We can use a similar
idea to determine if a string is a mirror. A mirror can be thought of as a special form of a
palindrome, and consists of a string of the form:
LmR
where:
m is the mirror character at the centre of the string
L and R are strings where R is the reverse of L (They may be empty strings)
L and R are formed from a limited set of characters that do not include m
Some examples of the abc mirror pattern (i.e. L and R are limited to the characters abc):
cmc
bbaamaabb
m
abacmcaba
These strings do not fit the abc mirror pattern:
abmb
gmg
abacmcabb
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents