some algorithm code snippets