User talk:MichaelChrisco: Difference between revisions
Content added Content deleted
(Update on Bead sort. Created a negative version of the algorithm) |
|||
Line 1: | Line 1: | ||
Thanks for squelching that spam. (Google Translate says it was some kind of advert for a Russian factory. Inappropriate for here for sure.) –[[User:Dkf|Donal Fellows]] 08:41, 27 July 2010 (UTC) |
Thanks for squelching that spam. (Google Translate says it was some kind of advert for a Russian factory. Inappropriate for here for sure.) –[[User:Dkf|Donal Fellows]] 08:41, 27 July 2010 (UTC) |
||
:ya no kidding. You are welcome. |
:ya no kidding. You are welcome. |
||
===Bead sort: An update=== |
|||
<lang cpp> |
|||
void distribute( int dist, vector<int> &List)//in theory makes *beads* go down into different buckets using gravity. |
|||
{ |
|||
dist=-dist; //resets to positive number for implamentation |
|||
if (dist > List.size() ) { |
|||
List.resize(dist,0);//can be done differently but *meh* |
|||
} |
|||
for (int i=0; i < dist; i++) |
|||
{ |
|||
List[i]=List[i]-1; |
|||
} |
|||
} |
|||
//same exact main as below. |
|||
</lang> |
|||
#1 Beads falling down: |
|||
Beads on their sides: -3 -2 -2 -1 |
|||
#2 Beads right side up: |
|||
Sorted list/array -4 -3 -1 |
|||
Output: |
|||
===Bead sort: a Unique Solution=== |
===Bead sort: a Unique Solution=== |