Skip to main content

All Questions

Filter by
Sorted by
Tagged with
2 votes
1 answer
78 views

In-Place Merging of Two Bubble Sorted Linked Lists (Python)

I'm following a tutorial on merging two bubble-sorted Single Linked Lists in Python. merge1 does the merging by creating a new list with maybe \$O(N+M)\$ memory ...
Emma Marcier's user avatar
  • 3,702
5 votes
2 answers
2k views

Non-recursive implementation of MergeSort

I've been trying to internalize some of the basic sorting algorithms recently, and to do so I've been looking at their wikipedia pages to refresh myself with how they work, and then coding my own "...
dgamz's user avatar
  • 61
4 votes
1 answer
184 views

Shakesort in Python 3

I've done the shakesort algorithm win \$O(n^2)\$, but it doesn't seem that \$O(n^2)\$ is correct because it takes 6-9 steps in the while loop for a list of 4 ...
jkansjkdkas's user avatar
4 votes
3 answers
4k views

Sort a stack of numbers in ascending order only using push

I have a stack of numbers ranging from 1 to 1 million representing a pile of numbered DVDs. Given the stack in random order I am to sort the stack by only taking an element from the stack and push it ...
Nekroz's user avatar
  • 43