Learning Algorithms via Neural Logic Networks