AC algorithms implementation.

Change-Id: I019ea2a0f6843d4e587d6a806a4894ffef380294
Signed-off-by: Chilam Wang <sjtu.zhilin@gmail.com>