Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assign a data structure to 1 A & B look at the bingo figure. From the following

ID: 3581800 • Letter: A

Question


Assign a data structure to 1 A & B look at the bingo figure. From the following list ( Array, Queue, Stack, Linked List, Binary Tree, Heap (Priority Queue), Hashtable, Graph). Explain: 1. why you chose the data structure. 2. whether you would use java's implementation of the data structure. 3. describe why the data structure is the best for efficiency. 1. For a program modeling a bingo game B I N G O 14 29 38 52 4 18 33 48 62 16 60 21 9 2244 12 23 35 42 73 A. What data structure should I use for each Playing card? B. What data structure should I use to keep track ofthe numbers that have been called so that they are easy to search for?

Explanation / Answer

Bingo game includes multiple wins like first row , second row, Full house etc.

Considering that winning only means when all numbers are crossed on the bingo card. So in this case if we go implementing Bingo Card in java, then we can use ArrayList.

Array list will expand to store 25 random integers.

ArrayList<Integer> myBingoCard= new ArrayList<Integer>();

Random number generator for range 0-90 can be implemented to fill 25 integers in the list.

A number is crossed off my removing it from Arraylist. Player will win when size of ArrayList myBingoCard.size()==0.

Another way is to implement is using Array of integers

int[] myBingoCard; // will contain 25 random integers. myBingoCard[k] is crossed off by setting it to -1.

int numCrossedOff; // player wins when numCrossedOff reaches 25.

Above data structures are easy to implement and is efficient too.