【发布时间】:2009-02-19 18:23:13
【问题描述】:
给定两个数组,是否有一种快速算法可以找到两个数组中所有不同的元素?例如,考虑两个 Keys 数组(如键盘键)结构。一个代表当前按下的按键,另一个代表上一个时间步按下的按键。
Keys[] oldKeys = LastKeyboardState.GetPressedKeys();
Keys[] currKeys = CurrentKeyboardState.GetPressedKeys();
// the user just pressed these key(s) during the last timestep.
Keys[] diff = ...
非常感谢您的建议!
【问题讨论】: