1- Describe a data structure suitable for representing a board configuration dur
ID: 3580800 • Letter: 1
Question
1- Describe a data structure suitable for representing a board configuration during a chess game?
2- Identify the data structures and procedures that might appear in an abstract data type representing an address book.
3- Design a procedure for combining two sorted contiguous lists into a single sorted contiguous list. What if the lists are linked?
4- What is the difference between a user- defined data type and a primitive data type?
5- What is the difference between an abstract data type and a user-defined data type?
Explanation / Answer
1).
As we know, a chessboard is comprised of an 8X8 checkered grid, so totally 64 squares. It is a
two-player game, each player of which has 16 pieces. Each piece can occupy only one square.
So at the beginning of the game there are 32 occupied and 32 vacant squares. Each cell would
need to contain the information about the type of piece it accommodates (i.e. King, Queen,
Rook, Knight, Bishop, Pawn) as well as the color (Blaclehite). The type of piece can be
identified by a string data type. The color can be identified by a Boolean data type.
Each cell can thus be described by a User-Dened data
Dene type ChessCell to be
{
Char Piece[10];
Boolean Color;
}
we can then extend this denition to the entire grid by dening a tWO dimensional array or cells:
ChessCell Cells[8][8]; Thus we see that even User-Dened data types can be extended to
arrays to allow for multiple instances or a dened data
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.