C*的小进步
flyfy1
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
明白了 fopen 的参数 w+, r+, a+
本来想写自己的理解的……结果查查发现这个把细节写的很好很完美,直接粘过来算了: "a" Append to a file. Writing operations append data at the end of the file. The file is created if it does not exist. "r+" Open a file for update both原创 2009-11-03 16:56:00 · 44482 阅读 · 0 评论 -
Algorithms: Merge Sort -- 归并排序
原来 Merge Sort 的中文名字是 归并排序。《Introduction to Algorithms》上面这个方法很强势啊,用递归实现。这里我用C和Java实现。以前自己用C实现:#include #include void merge(int *A, int p, int q, int r){ int L[q-p+2], R[r-q+1]; int i,原创 2009-12-02 22:42:00 · 723 阅读 · 0 评论 -
C++实现任意表达式求值(栈)
今天花了大概四个小时时间,用栈(stack)实现了“任意表达式的值计算”的问题。 C++ 比 C 好的一点就是,C++ 的STL定义了大量的数据类型和算法,相比于 C 更加视觉化。 实现这个的基本思路很简单:分成两部分完成。两个主要函数: string shorten(string m) 把 string m 由中缀式变为右缀式,double calculate(stri原创 2010-02-16 10:51:00 · 19013 阅读 · 8 评论
分享