![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
suyksuyk
I specialize in C .
I am eager to improve myself.
I like making friends.
展开
-
call stack
When you make a function call, the computer saves on the stack (on the top, of course)four things, which are listed here. Note that this process is true for all function calls, notjust those that转载 2009-09-11 09:07:00 · 639 阅读 · 0 评论 -
hash
Questions and AnswersQ: In the implementation of chained hash tables presented in this chapter, the actual hash code used for accessing the table is the hash code modulo the table size. Why is this转载 2009-10-29 11:06:00 · 522 阅读 · 0 评论 -
Sorting and Searching
12.21 Questions and AnswersQ: Suppose we need to sort all of the customer records for a worldwide investment firm by name. The data is so large it cannot be fit into memory all at once. Which sortin转载 2009-10-28 09:32:00 · 941 阅读 · 0 评论 -
找第一个出现的字符
C/C++ code#include #include using namespace std;int main(){ string s("agaabbbcccsdddefffg"); int appear=0; int appeared=0; int repeated=0; for(string::size_t转载 2009-10-19 14:44:00 · 553 阅读 · 0 评论 -
二叉搜索
#include #include #include using namespace std; class Node { public: int data; Node *parent; Node *left; Node *right; public: Node():data(-1),parent(NULL),left(NUL转载 2009-10-19 14:11:00 · 491 阅读 · 0 评论 -
12个高矮不同的人,排成两排,
作者:baihacker 来源:http://hi.baidu.com/feixue http://hi.csdn.net/baihacker 问题描述: 12个高矮不同的人,排成两排,每排必须是从矮到高排列,而且第二排比对应的第一排的人高,问排列方式有多少种? 这个笔试题,很YD,因为把某个递归关系隐藏得很深. 问题分析: 我们先把这12个人从低到高排列,然后,选择6个人排在第一排,那么剩下的6转载 2009-10-19 13:33:00 · 9193 阅读 · 3 评论 -
二叉搜索树
#include using namespace std; class Node { public: int data; Node *parent; Node *left; Node *right; public: Node():data(-1),parent(NULL),left(NULL),right(NULL){}转载 2009-10-19 10:55:00 · 756 阅读 · 0 评论 -
二分法
作者:baihacker 来源:http://hi.baidu.com/feixue http://hi.csdn.net/baihacker 二分原理: 设f是定义在[a, b]上的bool函数,且满足性质若f(i) = true则f(i+1) = true. 那么算法: int l = a, r = b; while (l { int mid = (l + r)/2; if (f(mid))转载 2009-10-16 15:57:00 · 705 阅读 · 0 评论 -
100000th prime algorithm by baihacker ....
Attention:是第第第100,000个,不是100,000以内!!!! 貌似这个数很大啊~这是金山的笔试题目,怎么算?说出大致思想也成,拜谢了!遍历肯定是不行的吧?虽然我答案就是用写的遍历-_-""!#include #include unsigned int s[100000] = {2};unsigned int s_i = 1;inline int转载 2009-10-16 13:32:00 · 630 阅读 · 0 评论 -
堆
#include stdlib.h>#include stdio.h>// * ---------------------------------------- */// * 建立堆 */// * ---------------------------------------- */void adjust_heap(int *h转载 2009-11-06 13:34:00 · 514 阅读 · 0 评论