I was recently looking at the wikipedia article for Gnome Sort and it got me thinking. Gnomes sorting garden pots have a slightly different computational model than computers do, in that moving along the line of pots takes time.
So given the constraints on the gnomes (can only carry one pot at once, walking takes time), Gnome sort seems like it really does take less time (walking steps) than, say, Bubble Sort.
It looks to me like, for gnomes:
Can a gnome sort a line of flower pots faster than O(n^2 ), counting walking steps? Merge sort seems promising maybe, and it seems like it might matter whether the gnome is allowed to temporarily lay the pots out in 2D space or not.
I'm quite new to programming, I'm still reading Crash course and ATBSWP, but last night in bed I came up with a way of sorting a random list of numbers.
Here's my code: https://pastebin.com/UHPshGe4
I appreciate I won't be the first person to come up with this, and I know there are more elegant ways of doing it, but I feel it's not bad for a beginner?
Any feedback you guys could give would be appreciated.
A modern programming language is expected to provide a standard-library function for sorting. So, which algorithm did you use for that? I made up my own algorithm called HybridSort, which is a combination of MergeSort, QuickSort and SelectionSort. I used a genetic algorithm to get formulas for predicting which algorithm will be faster on some part of the array. I thought it was an excellent idea and that it will be about as fast as more mainstream sorting algorithms. However, it turns out it is significantly slower.
Hello all, I don't have really any capital to offer, but I would be willing to pay $5 to start a conversation about what I'm looking to build for my start-up. If you are offering some experience with data science and machine learning, I am willing to have a conversation with you about how we can jump into a working relationship for my start-up idea. Thanks for your consideration, and I hope to make a few connections along the way.
Shoot me a message with your interests, previous work, and/or education to get started.
Implemented with generators and matplotlib
I am making a game and ran into a problem where I need a specific type of sorting algorithm. It takes a sorting rule, for example 13240, then applies/enforces this rule to another list, for example 013245. Every number in the result has to be before or after every number in the rule (so in the result 3 would have to be after 1 but before 2). The result can have extra numbers that aren't in the rule, and those should remain in-place/retain their position in the list.
My algorithm idea is very simple. I simply iterate across and swap whenever a number should be before another, like so:
It seems to work for a few small examples. I'm not sure about it though since when a number gets swapped, the number it gets swapped with ends up further down and thus misses a few of its comparisons...
Is this correct or is there a better algorithm? I want to be sure before I go into implementing this. Thanks!
According to the paper, the real numbers normalised in (0,1), then put in table with level. No two number have same level. Then it uses merge algorithm to merge all level. It uses integer sorting. So, I understood after reading the paper but how can I translate it to high level language? If it is difficult then how to develop example type program for demonstration purpose. Thanks