Good tricks

  1. swap two number without temporary variable

    I:

    a = a - b; b = a + b; a = b - a;

    II:

    a = a ^ b; b = a ^ b; a = a ^ b;