Created the recursive graph function but there is a bug in the binary search function(SegFault)