Suggest an efficient data type to represent N board chess?

I have to suggest a Data Structure for an efficient chess game with a board length of N (input from user) and with up to P pieces.

The main issue is the complexity.

I have to insert a new piece to the board in O(log P),

Remove an existing piece in O(log P),

See if a piece is threatened or threatening another piece in O(log P),

and even finding all the possible moves for a given piece in O(log P).

I know that Binary Search Trees are going to take a big part in the solution.

I also have a limited extra space complexity of O(P).

Please help me find such way to represent said chess game with the given complexity which will allow my to implement the required tasks under these circumstances .

Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Helpful Social

Copyright © 2025 Q2A.ES - All rights reserved.