Presentations topics 1 Putting number into ascending order

Presentations

topics 1. Putting number into ascending order 2. Sorting

requirements • Algorithm – written in pseudo code, your approach for the problem. • Flowchart – a diagram representations. • Source code – should be bug free and has output as intended

Putting number into ascending order PROBLEM Input any three numbers. Print the numbers in ascending order. EXERCISE 1 Draw a flow chart for a program that does what the problem above states. If two or more numbers are equal, print the equal numbers in any order among themselves. EXERCISE 2 Trace your flow chart from Exercise 1. Use the set of input listed below. If the flow chart does not produce the correct output for a set of input, revise it until it handles all input sets correctly.

a. 2, 3, 4 b. 2, 4, 3 c. 3, 2, 4 d. 4, 2, 3 e. 3, 4, 2 f. 4, 3, 2 g. 2, 2, 2 h. 3, 2, 2 i. 2, 3, 2 j. 2, 2, 3 k. 3, 3, 2 l. 3, 2, 3 m. 2, 3, 3 Suggestion Divide the trace in two. Let one team member trace using sets a-g and let the other team member test sets h-m.

Sorting PROBLEM Sort a list of integers into descending order EXERCISE 1 Develop an algorithm for the problem above. Keep in mind the following. 1. Assume the list of integers is already in memory in an array. 2. Express the algorithm in English. You may write it in paragraph form or in outline form. 3. The teacher will be glad to look at what you have and tell you whether you are on the right track, whether it is specific enough, and so on. EXERCISE 2 Write, run, and debug a program that implements the sorting algorithm you developed for Exercise 1.
- Slides: 6