Binary partitioning

could you please share some codes with me as well sir?