DOC PREVIEW
MIT 16 01 - Study Notes

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CP2-4 The problems in this problem set cover lectures C2, C3, and C4. 1. Part a. Write an algorithm to check if a user entered string is a palindrome. Assume: i. Maximum string length is 80 characters ii. The actual string length is input dependent Part b. Implement your algorithm as an Ada95 program. Turn in a hard copy of your algorithm and code listing; and an electronic copy of your code. 2. Modify the program above to read inputs from a text file and store the reversed stringin an output text file. The program should: a. If the line of text is a palindrome, store it in the output file. b. If it is not a palindrome, reverse the line of text and store the reversed line of text in the output file. c. Repeat the above steps until there are no more inputs to be processed from the input file. Assume: i. Input file name is my_program_input.txt ii. Output file name is my_program_output.txt Turn in a hard copy of your algorithm and code listing and an electronic copy of your code. 3. a. Compare and contrast stacks and queues.Hint: Summarize the operations on stacks and queues using a table and use a diagram to show the difference between basic operations. b. Modify the expression conversion algorithm shown in class to include unary operators.Hint: i. Unary operators operate on only one argument. -5, +9 etc ii. How do you distinguish between a unary and binary operator? (Think about the number of arguments) Unified Engineering Spring 2004Unified Engineering Spring 2004Unified Engineering Spring 2004Unified Engineering Spring 2004iii. Use the following test expression -5 + 9 + -6 + 2 to see if the conversion works. Assume: i. The unary operators are only ‘+’ and ‘-’. ii. Inputs are user input strings of maximum length 80. c. Implement your algorithm as an Ada95 program.Turn in a hard copy of your algorithm and code listing, and an electronic copy of your


View Full Document

MIT 16 01 - Study Notes

Documents in this Course
Fluids

Fluids

3 pages

Fluids

Fluids

4 pages

Fluids

Fluids

4 pages

Fluids

Fluids

5 pages

Load more
Download Study Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Study Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Study Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?