Optimal Task Allocation For Crowdsourcing Applications