Skip to main content

All Questions

Filter by
Sorted by
Tagged with
4 votes
1 answer
732 views

Performant Sort function for big arrays

In sort(arr), I want to sort an array. Children must be beneath their parent. And children of the same parent are sorted using ...
Helix112's user avatar
  • 143
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
1 answer
246 views

Category of sorting algorithm and complexity [closed]

Just for fun, I wrote a sorting algorithm. I did not compare this with existing sorting algorithms.Can someone tell me what class of sorting algorithm this is and it's complexity? The algorithm ...
teeboy's user avatar
  • 101
3 votes
1 answer
5k views

Calculating the most profit from an array of stock prices

I'm a newbie learning how to code, and I am trying to find the most efficient way to calculate the most profit from an array of stock prices. For a given array,I have a list of stock prices over n ...
JohnnyTheJet's user avatar
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
5 votes
1 answer
6k views

Sort a given string in ascending order

This code sort the string below in ascending order. I'd prefer it split-up in two or three smaller, simpler methods. I'm also wondering whether my algorithm has a decent time complexity. Given string ...
Adam's user avatar
  • 405
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