03-prove_response

docx

School

Brigham Young University, Idaho *

*We aren’t endorsed by this school

Course

212

Subject

Computer Science

Date

Nov 24, 2024

Type

docx

Pages

1

Uploaded by ajarwee1

Report
CSE 212 – Programming with Data Structures W03 Prove – Response Document Name: James Leenue Kennedy Date: September 30,2023 Teacher: Brother Zachariah Alvey It is a violation of BYU-Idaho Honor Code to post or share this document with others or to post it online. Storage into a personal and private repository (e.g. private GitHub repository, unshared Google Drive folder) is acceptable. Question 1 : From Part 1, describe what the Mystery Stack 1 code does and how the use of a stack helps in the implementation. Answer. The mystery stack 1 code define a variable with a empty list, and it also add each of Letters of the provided text to the list, on the other hand the list length is bigger then 0, that removes the letter from the list thus creating the reverse words. Question 2: From Part 1, what are the three outputs from the Mystery Stack 1 code for the following three different inputs? Racecar= racecar Stressed= desserts a nut for a jar of tuna= anut for raj a rof tun a Question 3 : From Part 2, describe what the Mystery Stack 2 code does and how the use of a stack helps in the implementation. Answer. The mystery stacks 2 code checks through the list for numbers and appends those numbers to the stack. When those numbers are appending, it finds the mathematical operators in the list and perform the calculation based on the operation from the last 2items in the list. After those operations had been made, it appends the result to the list, when it finds another operator, it keeps performing the same and in the end, it returns the index 0 as a result. Question 4 : From Part 2, answer the following regarding what the Mystery Stack 2 code does: What will the result be if the input parameter is: 5 3 7 + * -“50” What will the result be if the input parameter is: 6 2 + 5 3 - /-“4” What input parameter would result in the display of “Invalid Case 1!” –“6/” What input parameter would result in the display of “Invalid Case 2!” - “62/0/” What input parameter would result in the display of “Invalid Case 3!” -“634/+” What input parameter would result in the display of “Invalid Case 4!” – “532+”
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help