hw06 - CS 159 Spring 2011 HW #06 5 Points Possible Due:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 159 – Spring 2011 HW #06 – 5 Points Possible Due: April 11, 2011 at 11:00pm Problem: Given 20 integers that are sorted from smallest to largest, remove the items in this data set in the fewest possible steps using the following process: An element X in the data set it can be removed along with X – 1 or X + 1 if they are present in the set. After each deletion, print the values remaining in the data set. Example Execution: Enter data #1: 1 Enter data #2: 2 Enter data #3: 5 Enter data #4: 6 Enter data #5: 7 Enter data #6: 8 Enter data #7: 9 Enter data #8: 10 Enter data #9: 11 Enter data #10: 13 Enter data #11: 15 Enter data #12: 17 Enter data #13: 19 Enter data #14: 20 Enter data #15: 21 Enter data #16: 22 Enter data #17: 23 Enter data #18: 27 Enter data #19: 28 Enter data #20: 30 Remaining Data (20):1 2 5 6 7 8 9 10 11 13 15 17 19 20 21 22 23 27 28 30 Remaining Data (17):1 2 8 9 10 11 13 15 17 19 20 21 22 23 27 28 30 Remaining Data (14):1 2 11 13 15 17 19 20 21 22 23 27 28 30 Remaining Data (11):1 2 11 13 15 17 22 23 27 28 30
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/11/2011 for the course CS 159 taught by Professor Crum during the Spring '08 term at Purdue.

Page1 / 2

hw06 - CS 159 Spring 2011 HW #06 5 Points Possible Due:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online