What are the techniques one can use to for chess board? What are the techniques one can use to keep all pieces   on a board ? It is like an n-queen problem 

Is it a combination of n-queen
To address the edit to the question
If you're receiving the pieces in a random order and you don't have any information about future pieces, the way to arrange the pieces would be to give pieces the least amount of scope. For example, if I were to receive a queen on the first turn, I would place it in one of the four corners. Some more rules would be to keep knights close to each other and pawns stacked one on top of the other. All of these strategies are a bit obvious, but it's difficult to have a consistent strategy to use as there are so many potential combinations of pieces.



This seems to me as more of a programming question than a chess one, but it's interesting nontheless! After thinking for a bit, I would hypthesize that the best way to approach this problem would be to use the knights as a baseline. It's well known that the maximum number of knights one can fit on a board is 32 (simply placing them on all squares of the same color), therefore having this as your starting position is logical as this is the maximum occupancy you can have with an individual piece. This strategy extends itself to an N x N board.

Afterwards, I would use pawns as their attacking prowess is limited to forward diagonals of one square in scope. They can occupy every other column (not rows as this would be limited to 2, 4, and 6 if following conventional rules), and this will add N/4 more occupied squares for an NxN board. This generalizes to a total number of occupied squares to N/2 + N/4, or simply 3N/4 total occupied squares.

This is the result of around 5 minutes of consideration, so my algorithm may be flawed. I hope this helps answer your question!