算法与趣味问题
USTC学弱
书写是为了更好的思考
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Insert_Sort
<br />#include <stdio.h>void insert_sort(int s[],int n){ int temp,i,j; for (i=1;i<10;i++) { temp=s[i]; j=i; while(temp<s[j-1]){ s[j]=s[j-1]; j--; } s[j]=temp; }}void main(){int a[10],i;printf("pleas原创 2011-03-27 21:20:00 · 675 阅读 · 0 评论 -
struct中字符串的赋值
<br />struct student{int age;char name[20];}stu1;<br />wrong:stu1.name="XXXX";<br />right: strcpy(stu1.name,"XXXXXX");原创 2011-03-26 18:22:00 · 891 阅读 · 0 评论 -
C语言中回车符
<br />问题:谭浩强的《C程序设计-第三版》中,第341页中,有句话不明白。如下:<br />“从键盘输入4个学生的数据是ASCII码,也就是文本文件,在送到计算机内存时,回车和换行符转换成一个换行符。……”其中的“回车和换行符转换成一个换行符”是什么意思?为什么是两个符号,为什么能转换成一个换行符?<br />解答:文本文件的行结束符,传统上<br />PC机 用 CRLF<br />苹果机用CR<br />unix 用 LF<br /><br />CR -- 回车符,c语言'/r原创 2011-04-14 22:19:00 · 7077 阅读 · 0 评论 -
快速排序及其优化
#include #include //调用C++自带Sort#include #include #include using namespace std;#define MAX 1000000#define K 12#ifdef _DEBUG#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)#endif // _DEB原创 2011-10-13 20:07:52 · 609 阅读 · 0 评论 -
红黑树的插入实现
package com.lkl;import java.util.*;public class RBTree { private static final boolean RED=false; private static final boolean BLACK=true; static class Node{ int key; Node left;原创 2011-10-27 00:02:53 · 640 阅读 · 0 评论
分享