06 2011 档案

摘要:就比如上面自己写的单链表建立这样的程序,其实明明知道输出单链表不能从头结点开始输入,而是要在第一个节点开始,可是自己在写程序时偏偏忘记了,我觉得原因之一就是一个精力集中在是对程序的语法上,第二可能是分心了,的确是忘记了,那么如何才能不忘呢。只有一个办法,熟能生巧。一旦形成条件反射了,也自然不会忘记了。不是说自己笨,只是大脑无法存储这么多数据。 阅读全文
posted @ 2011-06-22 11:32 thinking and coding 阅读(276) 评论(0) 推荐(0)
摘要:#include <stdlib.h> #include <stdio.h> #include <string.h> #include <conio.h> //using namespace std; typedef struct node { int data; node * next; }*linklist; void creat(linklist head,int a) { linkl... 阅读全文
posted @ 2011-06-22 11:28 thinking and coding 阅读(670) 评论(0) 推荐(0)
摘要:import java.util.*; public class MergeSort { /** * @param args */ static void mergeSort(int [] a,int [] temp,int left,int right) { if (left==right) temp[left]=a[left]; else { int temp2[]=ne... 阅读全文
posted @ 2011-06-21 11:27 thinking and coding 阅读(188) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <conio.h> void HeapAdjust(int a[],int s,int n)//大顶堆 { int temp=a[s]; for(int j=2*s;j<=n;j*=2) { if(j<n&&a[j]<a[j+1]) j++; if(temp>a[j]) break;//这个错误点困扰了我好长时间。temp写成a[s... 阅读全文
posted @ 2011-06-20 20:48 thinking and coding 阅读(241) 评论(0) 推荐(0)
摘要:Ø 一个很严肃的问题,如果一个数组是从0开始计数的。那么节点i的左孩子为2i+1,右孩子为2i+2;数据结构课本上的堆中的数组时从1开始计数的。所以做孩子为2i,右孩子为2i+1、 阅读全文
posted @ 2011-06-20 17:17 thinking and coding 阅读(207) 评论(0) 推荐(0)