add nnc algorithm