- 博客(20)
- 资源 (9)
- 收藏
- 关注
原创 C++选择排序法(Selection Sort)
// implementation of Selection Sort (C++)#include <iostream>using namespace std;void SwapTwo(int& a, int& b){ int temp=a; a=b; b=temp;}void SelectionSort(int arr[], int size){ for (int i=0; i<size;i++) { int Smalle
2014-04-04 17:37:25
4179
原创 C++插入排序法(Insertion Sort)
// implementation of Insertion Sort (C++)#include <iostream>using namespace std;void SwapTwo(int &a, int &b){ int temp = a; a = b; b = temp;}void InsertSort(int arr[], int size){ for (int i=1; i<size; i++) { int inser
2014-04-03 23:38:52
3026
原创 C---read directory
#include #include #include #include #include #include #include #include int main(){DIR *dir;struct dirent *dit;dir=opendir("new");if (dir==NULL){printf("the folder does not exist\n");
2012-06-11 18:04:39
1200
1
原创 c++求 两数 GCD
#include using namespace std;int GCD(int num1, int num2){ int mod=0; if ((mod = (num1%num2)) !=0) { return GCD(num2, mod); } else { return num2; }}int main(){ int num1, num2; cou
2012-05-12 19:58:33
1746
1
转载 RC4
RC4算法:1. 简述: 该算法以OFB方式工作:密匙序列和明文相互独立。它有一个8*8的S盒:S0,S1,S2,....,S255。所有项都是数字 0到255的置换,并且这个置换是一个可变长度密匙的函数。 2. 加密过程: 1>初始化S盒: 首先进行线性填充:
2012-05-12 13:33:21
509
原创 Playfair Cipher
Playfair Cipher 属于Block cipher的一种。其block size是两个字母大小, 选取一个单词座位key,无重复字母, 然后填写于5*5的方格中,剩下字母依次填入:两个字母X1和X2被加密为Y1和Y2的法则是:1. 如果X1和X2在同一横行,那么Y1和Y2分别问X1和X2右边的字母。(到末端循环从头开始)2. 如果X1和X2在同一竖列,那么Y1
2012-05-05 21:51:13
1619
原创 C++ 堆排序 (HeapSort)
// HeapSort/******************************************** aim: to sort an array in ascending order. 1. making a max-heap firstly(biggest on top). using siftup function (siftdown works as well if you
2012-03-15 17:58:27
2645
原创 二叉搜索(Binary Search)
// Binary Search#include using namespace std;void SwapTwo(int &a, int &b){ int temp = a; a = b; b= temp;}void SortNums(int nums[], int size){ for (int i=1; i<size; i++) { int j=i;
2012-03-13 16:31:48
529
原创 选择排序法 (Selection Sort)
// Selection Sort#include using namespace std;void SwapTwo(int &a, int &b){ int temp = a; a=b; b=temp;}int FindSIndex(int nums[], int start, int size){ int smallest = nums[start]; int
2012-03-13 15:13:45
477
原创 Recursive Fibonacci
/* Recursive Fibonacci*/#include using namespace std;int fib(int n){ int f0=0, f1=1; int num; if (n<2) return n; else { return fib(n-1)+fib(n-2); } }int main(){ int n; cout
2012-03-04 16:03:17
541
原创 C++冒泡排序法 (Bubble Sort)
// implementation of Bubble Sort (C++)#include <iostream>using namespace std;void SwapTwo(int &a, int &b){ int temp = a; a = b; b = temp;}void BubbleSort(int arr[], int size){ for (int i=0; i<size; i++) { int j = size
2012-02-29 14:14:36
834
c++国外大学lecture资料_part2.rar
2010-07-30
c++ 国外大学lecture资料_Part1.rar
2010-07-30
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人