Channel Assignment Algorithm implementation in C