乙個新的演算法 珠排序

2021-08-02 16:43:45 字數 1683 閱讀 6889

其實在c++裡面,有很多鮮為人知的演算法。比如說這個,珠排序,就是我翻了很久才找到的。

珠排序到底是什麼呢?其實原理跟他的名字一樣簡單,大概是這樣的:

首先,你要找到乙個算盤

上面有幾根柱子,可以放一些珠子。

輸入呢就是有幾就那一行有幾個珠子。

然後呢類似於乙個把這個算盤用力一震,使所有珠子子落下。

最後得到的就是上面小下面大的有序排列。

**:

#include #include int temp1,temp2;

int

main()

while(times <= 0);

printf("\n");

int numbers[times];

for (int k = 0;k < times;k++)

/************************find the largest number*************************/

int max = numbers[0];

for (int h = 0;h < times;h++)

} /**************************sort the numbers[1]***************************/

int te*** = 0;

int numbers1[max];do}

numbers1[i] = te***;

i++;

}while(i < max);

/**************************print the numbers[1]**************************/

printf("\nhere is the numbers after the first sorting: ");

for (int k = 0;k < i;k++)

printf("\b\b \n");

/**************************sort the numbers[2]***************************/

int numbers2[times];

int temp4 = 0;

int n = 0;

for(int l = 0 ;l < times;l++)

}numbers2[l] = temp4;

temp4 = 0;

}/**************************print the numbers[2]**************************/

printf("\nhere is the numbers after the second sorting: ");

for (int m = 0;m < times;m++)

printf("\b\b \n");

/****************************restart or end******************************/

printf("\n\n\nrestart or end?\n");

char rore;

dorore = toupper(rore);

}while(rore != 'r' && rore != 'e');

if(rore=='r')

}

好吧,到這

乙個新的開始

學習soa快三個月了,前途雖光明,自我卻茫然。soa涉及的知識面很廣,業務流程建模 服務顆粒度劃分 esb三類基本協議 soap,xml,web severice,如何跨平台 如何在上層應用soa 資料庫的soa,應用系統的soa,系統整合的soa 貌似soa是萬靈丹,可應用到各個層次。是突破口呢?...

乙個新的開始

從今天開始,就要開始一段未知的流浪。我們的方向 我們的依靠 我們的嚮導現在變成了我們自己。未來會是什麼樣子?一切來的太突然了,突然間我們像是離開父母遠行的孩子。之前總覺得只要努力就好,比賽似乎就是努力兩個字,儘管我奇懶無比,但那時我們真的被照顧的太好了,似乎只有比賽才是我們的事 其餘的事情會有他們來...

乙個新的開始

這是我第一次寫部落格。我的想法很簡單,就是記錄我在軟體道路上的軌跡和遇到問題解決問題的的經歷。我是這樣想的 雖然我現在是個菜鳥,但這也是我開始寫部落格最好的時間。因為這會記錄我從無到有的過程,也能盡量多的記錄我成長中所遇到的問題。我所寫的技術部落格主要方面是計算機作業系統,網路程式設計,嵌入式等等。...