1 nassau community collegeprof. vincent costa acknowledgements: an introduction to programming using...

12
1 Nassau Community College Prof. Vincent Costa Acknowledgements: An Introduction to Programming Usi ng Visual Basic 2012 , All Rights Reserved international, open membership, not-for-profit technology standards consortium. Session 4 Systematic Lists Pearson Custom Computer Science CSC 104 Nassau Community College CSC 104 Programming Logic and Problem Solving

Upload: juliana-mcdaniel

Post on 18-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights ReservedAn Introduction

1Nassau Community CollegeProf. Vincent CostaAcknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights Reserved

international, open membership, not-for-profit technology standards consortium.

Session 4Systematic Lists

Pearson CustomComputer Science

CSC 104Nassau Community

College

CSC 104Programming Logicand Problem Solving

Page 2: 1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights ReservedAn Introduction

2Nassau Community CollegeProf. Vincent CostaAcknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights Reserved

international, open membership, not-for-profit technology standards consortium.

Systematic List• Make a systematic list of all the ways

you can order the bits 0 and 1 into a 3 digit sequence, for example, 010.

• There are 8 different waysBit 1 Bit 2 Bit 3

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

Page 3: 1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights ReservedAn Introduction

3Nassau Community CollegeProf. Vincent CostaAcknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights Reserved

international, open membership, not-for-profit technology standards consortium.

Systematic List• Try a 4 digit sequence. ? different ways

Bit 1 Bit 2 Bit 3 Bit 40 0 00 0 10 1 00 1 1

Page 4: 1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights ReservedAn Introduction

4Nassau Community CollegeProf. Vincent CostaAcknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights Reserved

international, open membership, not-for-profit technology standards consortium.

Systematic Lists

• Another way of solving a problem is to make a systematic list. A systematic list is generated to organize information in a methodical way.

• A table is an easy way to organize a list – the columns are labeled with the information of the problem and the rows are the different possibilities

Page 5: 1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights ReservedAn Introduction

5Nassau Community CollegeProf. Vincent CostaAcknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights Reserved

international, open membership, not-for-profit technology standards consortium.

Systematic Lists

• Leslie has 25 cents in her pocket but does not have a quarter. If you can tell her all possible combinations of coins she could have that add up to 25 cents, she will give you the 25 cents!

• What would you put as the column headings? How could you systematically determine all the possibilities?

Page 6: 1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights ReservedAn Introduction

6Nassau Community CollegeProf. Vincent CostaAcknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights Reserved

international, open membership, not-for-profit technology standards consortium.

Systematic ListsDimes Nickels Pennies

2 1 0

Page 7: 1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights ReservedAn Introduction

8Nassau Community CollegeProf. Vincent CostaAcknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights Reserved

international, open membership, not-for-profit technology standards consortium.

More Football!

• Andrew and his friends have formed a fantasy football league in which each team will play one game against each of the other teams. There are 7 teams: Texas A&M (Aggies), Purdue (Boilermakers), Alabama (Crimson Tide), Oregon (Ducks), Boston College (Eagles), Air Force (Falcons) and Florida (Gators). How many games will be played in all?

Page 8: 1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights ReservedAn Introduction

9Nassau Community CollegeProf. Vincent CostaAcknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights Reserved

international, open membership, not-for-profit technology standards consortium.

More Football!Team1 Team2

Texas PurdueTexas AlabamaTexas OregonTexas BCTexas AFTexas Florida

Page 9: 1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights ReservedAn Introduction

11Nassau Community CollegeProf. Vincent CostaAcknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights Reserved

international, open membership, not-for-profit technology standards consortium.

More Football!

• Texas vs. 6 teams• Purdue vs. 5 teams• Alabama vs. 4 teams• Oregon vs. 3 teams• BC vs. 2 teams• AF vs. 1 team• How many games?? 21

• Could a diagram be used to solve this problem?

Page 10: 1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights ReservedAn Introduction

12Nassau Community CollegeProf. Vincent CostaAcknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights Reserved

international, open membership, not-for-profit technology standards consortium.

More Football!

• What if there is another team added to the league so there are 8? How many games would be played?

• 7+6+5+4+3+2+1 = 28• What if the league had 9 teams? • 10 teams?

Page 11: 1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights ReservedAn Introduction

13Nassau Community CollegeProf. Vincent CostaAcknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights Reserved

international, open membership, not-for-profit technology standards consortium.

Another Systematic List

• For her Shakespeare course, Kristen is to read all five of the following plays and choose three of them to write papers about: Richard III, The Tempest, Macbeth, A Midsummer Night’s Dream and Othello. How many different sets of plays can Kristen write papers about?

Page 12: 1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights ReservedAn Introduction

14Nassau Community CollegeProf. Vincent CostaAcknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights Reserved

international, open membership, not-for-profit technology standards consortium.

Homework

• Use a Systematic List to solve the last slide, the one about the Shakespeare course

• Due next class• Let me know if there are any

issues