implemented divide algorithm and some test cases.