making it so that the binary memoizer is optional, in case people run
into issues with space complexity