RNC algorithm