Basketball Lab
An On-Line Session Using a Sparse Array

Objective: to modify a given program to use a more efficient data structure

Using an array of 56 structs to hold information about the 12 or 13 players of a varsity or JV high school basketball team wastes memory. When an array is sparsely filled, it conserves memory to use an array of pointers to structs, rather than an array of structs, to hold the data. In this problem, it there is no player with a particular jersey number, that pointer can be the NULL pointer.

Program Description: The program permits you to select a starting roster of five players from the available players stored in your "team.txt" to form a valid basketball team consisting of one center, two forwards, and two guards.


___ 1. const
___ 2. typedef
___ 3. main
___ 4. initialize
___ 5. readFile
___ 6. printHeadings
___ 7. printPlayer
___ 8. duplicated
___ 9. valid
___ 10. printRoster
___ 11. printTeam
___ 12. done
___ 13. chooseStarters

File Formatting: The files consist of one line for each player listing the name with no spaces, jersey number, position, and height. A sample is shown below.

	Braitsch,Leslie  42 f 72
	Heitz,Gretchen   10 g 66
	Leyton,Nicole    43 f 71
	Smith,Pat        31 f 70
	Day,Katie        50 c 73

Continue to:  Unit 6  / Prev  / Next