2012年11月2日

将链表逆序排列的一个程序及思考的对链表依某一元素排序方法

摘要: 遇到将链表逆序排列的问题,一开始觉得肯定会很复杂,后来猛然想到用数组存放地址程序如下:#include <stdio.h> #include <stdlib.h> #define N 6 typedef struct student {int num; char name[8]; int age; struct student *next; }BT; void main() {BT a[N]={{100,"Lui",20},{101,"Wang",21},{102,"LI",21},{105,"zha 阅读全文

posted @ 2012-11-02 18:53 天涯古人 阅读(217) 评论(0) 推荐(0) 编辑

将一个有序链表和一个无序链表合并,并按序号大小排序

摘要: 这里做的工作有很大局限性:未考虑两链表中序号相同时怎么办;表一必须是有序的,表二可以是无序的,这样能排序;感觉两个都是乱序的很难弄。但调了很久,记下纪念。#include <stdio.h> #include <string.h> #include <stdlib.h> #define LA 4 #define LB 4 #define NULL 0 struct student {int num; char name[8]; struct student *next; }a[LA],b[LB]; void main() {struct student a[ 阅读全文

posted @ 2012-11-02 10:59 天涯古人 阅读(515) 评论(0) 推荐(0) 编辑

导航