关于数据结构算法
以下是一条公司出的题目,求答案:
Data Structure
Giving the following requirements:
Favorite sport - enum(baseball, hockey, football, soccer, basketball)
Hours Training - number from 0 to 50
Favorite Team - enum(Canadiens, Nordiques)
Favorite color - enum(black, white, blue, red, yellow, green, brown, pink)
what would be the bit representationusing the most optimal algorithm of the following choices:
hocky, 7, canadiens, red
[解决办法]
struct XXX
{
char Sport :4;
char Color :4;
char Hours :6;
char Team :1;
};