Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

The lion gate at mycenae famously utilizes which engineering technique

26/11/2021 Client: muhammad11 Deadline: 2 Day

Stacks And Queues

Stacks and Queues In this assignment, you will be implementing Stacks and Queues. You will then use stacks and queues to test if words are palindromes, and use stacks to decompose phrases into words (to find new palindromes).

● Implement ​MyStack​ (use the included ​MyLinkedList​ to store the stack elements) ○ Implements ​StackInterface ○ Throws a ​StackException​ if peek or pop are called on an empty stack

● Implement ​MyQueue​ (use ​MyLinkedList​ to store the stack elements) ○ Implements ​QueueInterface ○ Throws a ​QueueException​ if peek or dequeue are called on an empty queue

● Test your MyStack and MyQueue ​thoroughly ● In ​Palindrome.java

○ Implement ​stackToReverseString()​ using MyStack ○ Implement ​reverseStringAndRemoveNonAlpha()​ using ​MyStack ○ Implement ​isPalindrome()​, which returns true if a word or phrase is a

palindrome, using ​MyStack​ and ​MyQueue ○ CHALLENGE: Implement ​explorePalindrome()​ which lists all possible

backwards decompositions of a phrase (e.g. “evil guns” => snug live“), a common trick to make new palindromes (uses MyStack)

● Style requirements ​(NEW!) ○ Indent your code properly

■ There are several mainstream “styles” of indentation, pick one and be consistent. EG: ​https://javaranch.com/styleLong.jsp

○ Name your variables with helpful and descriptive names ■ Whats a good variable name? Here is a ​guide

○ Add comments before every function, and in your code ■ Comments should say ​what you are trying to do​ and ​why ■ Consult this ​guide to commenting

Point breakdown Stacks ​ - 20 points Queues ​ - 20 points Style ​ - 15 points Implementing the functions: String ​stackToReverseString​(MyStack)​ - 10 points String ​reverseStringAndRemoveNonAlpha​(String)​ - 5 points Boolean ​isPalindrome​(String)​ - 10 points

https://javaranch.com/styleLong.jsp
https://a-nickels-worth.blogspot.com/2016/04/a-guide-to-naming-variables.html
https://code.tutsplus.com/tutorials/top-15-best-practices-for-writing-super-readable-code--net-8118
void​ ​explorePalindrome​()​ (and its helper)​ - 20 points

Implementing MyStack and MyQueue In this assignment, we will be making heavy use of the classes ​MyStack​ and ​MyQueue​. You have already implemented ​ MyLinkedList.java​ in a previous assignment. You can use your code, or the sample ​MyLinkedList.java ​provided. Implement ​MyStack.java​ and ​ MyQueue.java ​using the provided interfaces and exceptions. Make sure you have implemented a ​public​ String ​toString​()​ method on MyStack and MyQueue that prints out the contents of the stack from the top down and prints out the queue from the front to back. So, for example, after the following code:

MyStack stack = ​new​ MyStack(); MyQueue queue = ​new​ MyQueue(); stack.push(​"Hello"​); queue.enqueue(​"Hello"​); stack.push(​"big"​); queue.enqueue(​"big"​); stack.push(​"world"​); queue.enqueue(​"world"​);

System.out.println(​"Stack = "​ + stack); System.out.println(​"Queue = "​ + queue);

Then the output would be:

Stack = (world, big, hello)

Queue = (hello, big, world)

Test your code thoroughly!! ​We have provided ​TestQueuesAndStacks.java​ as an example of some ways to test your code, but you will want to edit it to try out many possible situations. Make sure your code behaves ​exactly ​ as you expect it to, before starting the second half of the assignment.

Is this a palindrome? A palindrome is a word or phrase that reads the same backwards and forwards, if you ignore punctuation and spaces. For example:

● A dog! A panic in a pagoda!

● ABBA ● Cigar? Toss it in a can. It is so tragic. ● Yo, bottoms up! (U.S. motto, boy.) ● Stressed was I ere I saw desserts.

(from ​http://www.palindromelist.net/palindromes-y/​) In this part of the assignment, you will be writing several functions in ​Palindrome.java ​to test and create palindromes using your stack and queue implementations.

Example Input & Output Palindrome.java​ takes as input: a ​mode ​, and some ​words. ​The mode is either “test” or “expand”, so the function call will be: Test for palindromes Are these phrases palindromes?

javac Palindrome.java && java Palindrome test "oboe" "ABBA" "I'm alas, a

salami" "evil liver"

'oboe': false

'ABBA': true

'I'm alas, a salami': true

'evil liver': false

Expand palindromes Which words could be added to make this a palindrome?

javac Palindrome.java && java Palindrome expand "an era live" "mug god"

an era live: evil a ren a

an era live: evil aren a

an era live: evil arena

mug god: dog gum

http://www.palindromelist.net/palindromes-y/
Functions to implement: String ​stackToReverseString​(MyStack)​:​ your toString function in your stack class prints out the stack in the order that things would be popped from it. What if we want to turn it into a string in the opposite order (the order that things were ​pushed to it)? In Palindrome.java, we do not have access to the internal representation of the stack’s list. So instead, we have to pop everything off the stack, read it in order and push it pack onto the stack in the original order so that the stack is unchanged (​Whew!​)

● Create an empty string ● Create a new temporary stack ● Pop everything from the original stack onto

the new stack ● Pop everything from the new stack back

onto the original stack ​and​ add it to the string

String ​reverseStringAndRemoveNonAlpha ​(String) Use a stack to reverse a string. Similar to before. Also, we want to not only

● Create a new stack. ● Iterate through the string, and push each character from the string onto the stack, but

only if ​they are alphabetic (ignore spaces and punctuation) ○ Character.isAlphabetic ​will be a useful function here!

● Pop everything from the stack to reconstruct the string in reverse.

● Note: your stack can only contain Objects. Java’s ​char​ datatype isn’t an object though! This means that you will have to wrap it (and later cast it) as a ​Character​ type. Look up the Character class in Java’s documentation, or find out more about wrapper classes here ​.

Boolean ​isPalindrome​(String) Implement this function using ​ both a stack and a queue. To test if a string is a palindrome:

● Convert the string to lowercase (we don’t care about uppercase vs lowercase characters being different)

● Create a new stack and queue. ● Enqueue and push each character (if it is alphabetic, we don’t want to look at white

space or punctuation) ● Pop each character from the stack and dequeue each character from the queue until

one is empty ● Notice how in our above functions, pushing and then popping from a stack ​reversed the

order. ​How will you use this to test whether this string is a palindrome?

void ​explorePalindrome​(String) This function lists all possible endings that would make this string a palindrome, e.g.:

javac Palindrome.java && java Palindrome expand "an era live" "mug god"

an era live: evil a ren a

an era live: evil aren a

an era live: evil arena

First, convert the string to lowercase and use your ​reverseStringAndRemoveNonAlpha function to reverse it and remove non-alphabetical characters. Now, most of the work will be done by a recursive helper function to decompose this new string (“evilarena”) into words. Takes the original string, the reversed string, an index, and the current stack of words we are building up

​public​ ​static​ ​void​ ​decomposeText​(String originalText, String textToDecompose, ​int​ index, MyStack decomposition)

We have provided a function ​ String[] getWords(String text, ​int​ index) ​that uses a dictionary to find which words could be created from a string at a given index. For example getWords(​"isawere"​, ​0​) ​could find the words “i” and “is”, ​ getWords(​"isawere"​, ​2​)​ could find the words (“a”, “aw” and “awe”). A recursion step:

https://en.wikipedia.org/wiki/Primitive_wrapper_class
● If the index is at the end of the word, we are finished, print out the words (using reverse print) and the original text.

● Else: Find the potential words at that index ● For each word:

● Push it to the stack ○ Recurse at the next index (not *just* i++) ○ If it was part of a correct solution, it will print itself out in a subsequent

recursion step (if it reaches a conclusion) ● Pop it from the stack

● Confused? See below for a visual explanation of this approach. ○ As usual, println statements may help you understand your code’s operation if

you get lost. Consider outputting the list of words from getWords, or printing out the ​decomposition​ stack each time you push or pop from it. Just remove your debug statements before turning in your code.

Turning the code in

● Create a directory with the following name: _assignment3 where you replace with your actual student ID. For example, if your student ID is 1234567, then the directory name is 1234567_assignment3

● Put a copy of your edited files in the directory (MyQueue.java, MyStack.java, and Palindrome.java)

● Compress the folder using zip. Zip is a compression utility available on mac, linux and windows that can compress a directory into a single file. This should result in a file named _assignment3.zip (with replaced with your real ID of course).

● Double-check that your code compiles and that your files can unzip properly. You are responsible for turning in working code.

● Upload the zip file through the page for ​Assignment 3 in canvas

https://canvas.ucsc.edu/courses/12730/assignments/40191
Visual example of palindrome search with stacks

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Financial Hub
Quality Assignments
Professional Accountant
Academic Master
Solution Provider
Study Master
Writer Writer Name Offer Chat
Financial Hub

ONLINE

Financial Hub

I have assisted scholars, business persons, startups, entrepreneurs, marketers, managers etc in their, pitches, presentations, market research, business plans etc.

$34 Chat With Writer
Quality Assignments

ONLINE

Quality Assignments

This project is my strength and I can fulfill your requirements properly within your given deadline. I always give plagiarism-free work to my clients at very competitive prices.

$42 Chat With Writer
Professional Accountant

ONLINE

Professional Accountant

I can assist you in plagiarism free writing as I have already done several related projects of writing. I have a master qualification with 5 years’ experience in; Essay Writing, Case Study Writing, Report Writing.

$33 Chat With Writer
Academic Master

ONLINE

Academic Master

This project is my strength and I can fulfill your requirements properly within your given deadline. I always give plagiarism-free work to my clients at very competitive prices.

$29 Chat With Writer
Solution Provider

ONLINE

Solution Provider

I am a PhD writer with 10 years of experience. I will be delivering high-quality, plagiarism-free work to you in the minimum amount of time. Waiting for your message.

$41 Chat With Writer
Study Master

ONLINE

Study Master

As per my knowledge I can assist you in writing a perfect Planning, Marketing Research, Business Pitches, Business Proposals, Business Feasibility Reports and Content within your given deadline and budget.

$40 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

Positive connotation for self focused - POL 201 American National Government NO PLAGIARISM PLZ Final Paper for Class Thank you!! - Estonia homework - Effect of sunlight on plant growth - Decoding goals and objectives for iep - Into thin air krakauer pdf - Lies my teacher told me chapter 11 - Possible 5 digit combinations 0 9 - Operational Excellence Discussion - Painter on a scaffold physics - Invacare platinum 10 manual - 49ers Ovo San Francisco Jacket - Seven eleven japan supply chain - Your Leadership Profile - An alarm clock draws 0.5 a of current - Premier waste north east - Vce grade distribution 2020 - Help - Slope field of x 2 - Ethical issues in family counseling - Dobbins the things they carried - Flax bourton coroners office - Reynolds adaptable intelligence test manual - Cure for diabetes ielts reading answers - Braveheart freedom speech analysis - Stratco gable homeshed instructions - Write a essay - Yazaki global purchasing singapore pte ltd - Garden variety flower shop uses clay pots - Short essay - ''You will get best ever subject NOTES in your class'' - Seymour leisure centre membership prices - 5 c's of business - Nebosh igc element 1 foundations in health and safety notes - Imagine song lyrics meaning - Step by step to college and career success 8th edition - 1 page assignment - Management Project - Arroz con pollo café con leche cereales espárragos huevos refresco sándwich de jamón entremeses - Fi quotes tomorrow when the war began - .88 usd to aud - Discussion question 200 words for tomorrow at 9:00 am - Advertising part 4 - Systems of psychotherapy 9th edition - Transpose of a matrix in c using dynamic memory allocation - Psychological skills training programme - CASES CASE 35 CIRQUE DU SOLEIL* The founder of Cirque du Soleil, Guy Laliberté, after see- ing the firm’s growth prospects wane in recent years, was thinking about expanding his firm in new directions. For three decades, the firm had reinvented and revolutionized the circus. From its beginning in 1984, Cirque de Soleil had thrilled over 150 million spectators with a novel show concept that was as original as it was nontraditional: an astonishing theatrical blend of circus acts and street enter- tainment, wrapped up in spectacular costumes and fairy- land sets and staged to spellbinding music and magical lighting. Cirque du Soleil’s business triumphs mirrored its high- flying aerial stunts, and it became a case study for business school journal articles on carving out unique markets. But following a recent bleak outlook report from a consultant, a spate of poorly received shows over the last few years, and a decline in profits, executives at Cirque said they were now restructuring a - Golden age lyrics fergus james - Zn c2h3o2 2 na3po4 - Nasw code of ethics pdf 2017 - Discussion #2 - 3 page paper - Max the chimney sweep trumbull ct - What do uchida and momaday feel toward their families - Sudwala lodge holiday club - C3925 vsec cube k9 - Luther leads the reformation - Lab homework - Craig kielburger obstacles - Sum of the parts valuation damodaran - Limiting and excess reactants worksheet - Given the project network and baseline information - Bad physics in movies - Trends and issues in hospitality and tourism industry - Only intended for wizard Kim - Max's maximum case study - Flash Fiction - Pauline Apologetics - Removal of retained sutures anterior cornea right eye cpt code - Michelson v united states - The arp entry deletion failed the requested operation requires elevation - Red bank fireproof mortar - Ampex 8 track recorder - Characteristics of free enterprise - Abercrombie and fitch diversity issues - Independent & Dependent Variables - Humn 8660 - Dulux pale tendril exterior - Research Question - The austrian oak strongman - Horizontal linkages in organisation chart indicate - Higher english 10 mark question - Skill Builder #5 - Fully controlled rectifier using scr - American beauty plastic bag scene - William carlos williams to a poor old woman - Safe sleeping practices for child care services - Eight aesthetic principles - What does cate often call her twin sister answer key - Project management: achieving competitive advantage 5th edition - Strategic management rothaermel 4th edition pdf - My gashes cry for help - Portfolio Paper Big Data, Data Warehouse Architecture and Green Data - Reflection on newspaper article - THE FOUNDATION OF HEALTH CARE LAW AND ETHICS IN THE UNITED STATES- SLP - Marram grass cross section - Limitations of evidence examples - St ives uniting church - Code of practice: managing the work environment and facilities - Seinfeld o henry heiress