algorithm c