Algorithm for Shuffling a Linked List in n log n time

后端 未结 7 516
北荒
北荒 2021-01-30 05:37

I\'m trying to shuffle a linked list using a divide-and-conquer algorithm that randomly shuffles a linked list in linearithmic (n log n) time and logarithmic (log n) extra space

7条回答
  •  遥遥无期
    2021-01-30 06:10

    Bottom up merge sort without compares. while merging don't do any comparison just swap the elements.

提交回复
热议问题