An algorithm study for C