
数据结构
文章平均质量分 77
sky_clara
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LinkedList
struct Node;typedef struct Node *PtrToNode;typedef PtrToNode List;typedef PtrToNode Position;List MakeEmpty(List L);int IsEmpty(List L);int IsLast(Position P,List L);Position Find(ELEMENT_TYPE翻译 2012-08-09 19:17:51 · 465 阅读 · 0 评论 -
单链表的建立,测长,打印,删除,插入,排序,逆置
1、编程实现一个单链表的建立/测长/打印。 答案:#includeusing namespace std;//单链表结构体typedef struct student{ int data; struct student *next;}node; //建立单链表node *create(){ node *head,*p,*s; int x,cycle=1; hea转载 2012-07-27 09:52:56 · 1482 阅读 · 0 评论 -
双链表
第一步,创建一个链表节点,同时让链表节点的前后指针指向空指针,同时让头尾指针指向这个节点,注意,是指向这个节点,而不是这个节点的上下指针。第二步,新建一个链表节点,此时,让第一步的尾指针的next指针指向这个新节点,同时让这个新节点的prev指针指向tail节点,这样就形成了两个节点的链表了,形成链表之后,要让tail指针指向刚建的新节点,使得这个节点称为新的尾节点第三步,循环执行转载 2012-07-27 10:25:08 · 2569 阅读 · 0 评论 -
排序 : 3 选择排序
3 选择排序a 直接选择排序//选择排序 for(int i=0;i int min=i; for(int j=i+1;j if(ints[j] min=j; } } int temp;//把最小的元素交换到相应位置 temp=ints; ints=ints[min]; ints[min]=t转载 2012-07-27 17:18:39 · 714 阅读 · 0 评论 -
排序 : 1 交换排序
1 交换排序a 冒泡排序-----稳定标准的冒泡排序:ints是一个整型数组for(int i=0;i for(int j=0;j if(ints[j] int temp; temp=ints[j+1]; ints[j+1]=ints[j];转载 2012-07-27 16:48:59 · 526 阅读 · 0 评论 -
Stack
//C语言版#include #include using namespace std;const int EmptyToS=-1;const int MinStackSize=5;const int MaxStackSize=30;struct StackRecord{ int Capacity; int TopofStack; char *Array;};typedef翻译 2012-08-22 17:12:09 · 584 阅读 · 0 评论 -
反转单链表
// ConvertList.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include #include using namespace std;struct ListNode{ int Element; ListNode *Next;};typedef L原创 2012-08-24 10:20:36 · 412 阅读 · 0 评论 -
排序 : 2 插入排序
2 插入排序a直接插入排序直接插入排序(Straight Insertion Sorting)的基本思想是:把n个待排序的元素看成为一个有序表和一个无序表,开始时有序表中只包含一个元素,无序表中包含有n-1个元素,排序过程 中每次从无序表中取出第一个元素,将它插入到有序表中的适当位置,使之成为新的有序表,重复n-1次可完成排序过程。把a[i]插入到a[0],a[1],...,a转载 2012-07-27 17:08:50 · 647 阅读 · 0 评论