- 博客(8)
- 资源 (2)
- 收藏
- 关注
原创 创新工场2014笔试编程题答案
编程题 1. 堆排序 2. 求一个正整数N的开方,要求不能用库函数sqrt(),结果的精度在0.001 3. 给定一个矩阵intmaxtrixA[m][n],每行和每列都是增序的,实现一个算法去找矩阵中的某个元素element. bool Find(int *matrixA, int m, int n, int element) { bool found = false;
2013-09-18 13:19:48
2461
5
转载 关于内存对齐的一篇很好的文章
在最近的项目中,我们涉及到了“内存对齐”技术。对于大部分程序员来说,“内存对齐”对他们来说都应该是“透明的”。“内存对齐”应该是编译器的 “管辖范围”。编译器为程序中的每个“数据单元”安排在适当的位置上。但是C语言的一个特点就是太灵活,太强大,它允许你干预“内存对齐”。如果你想了解更加底层的秘密,“内存对齐”对你就不应该再透明了。 一、内存对齐的原因 大部分的参考资料都是如是说的: 1、
2013-07-14 11:36:35
617
原创 魔方图
#include #include using namespace std; const int N = 5; int main() { int i,j,k; int a[N][N]; cout<<"原始矩阵:"<<endl; for(i=0; i<N; i++) { for(j=0; j<N; j++) { a[i][j] = 0;
2012-10-26 12:27:01
616
原创 Splay树(代码)
//delete函数运行错误,希望有同学帮忙修改一下#include #include using namespace std; struct SplayNode { int value; SplayNode *parent; SplayNode *left; SplayNode *right; }; SplayNode *root; template
2012-10-26 12:16:24
484
原创 Treap树(代码)
#include #include #include using namespace std; const int MAX = 100; struct TreapNode { int key; //结点的值 int fix; //优先级 TreapNode *left; //左孩子 TreapNode *right; /
2012-10-26 11:17:54
532
原创 哈希表(开放寻址,线性探测)
#include #include #include #include using namespace std; const int HashSize = 11; const int NULLKEY = -1; int m = 0; struct HashTable { int elem[HashSize]; //存储基址 int count;
2012-10-26 11:13:22
1092
原创 哈希表(链地址法)
#include #include #include #include using namespace std; struct LNode { int data; LNode *next; }; class HashTable { private: int m; LNode **HT; int Hash(int key, int m);
2012-10-26 11:12:27
985
原创 排序算法(源代码)
#include #include #include #include #include #include using namespace std; void GetData(vector &vec); void Sort(vector &vec); int main() { srand( (int)time(NULL) ); vector
2012-10-26 11:02:01
391
mySVM源代码
2013-04-02
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人