Essays on Algorithms for Customer Acquisition and Retention in SaaS Business Model