Metaswitch interview question

Algorithm question related to doing bubble sorting on cards.