Sorting an array while moving duplicates to the end?

前端 未结 4 1244
盖世英雄少女心
盖世英雄少女心 2020-12-18 02:16

This was a question in one my friend\'s programming class.

Q. How do you sort an array of ints and then arrange them such that all dupl

4条回答
  •  清酒与你
    2020-12-18 03:09

    Welcome to the world of Data Structures and Algorithms. You're absolutely right in that you could sort that faster. You could also do it a dozen different ways. PHD's are spent on this stuff :)

    Here's a link where you can see an optimized bubble sort

    You might also want to check out Big O Notation

    Have fun and good luck!

提交回复
热议问题