数据结构:将两个有序的单链表合并成一个有序的单链表,要求用原表的结点空间。

[复制链接]
查看11 | 回复3 | 2013-3-28 16:18:53 | 显示全部楼层 |阅读模式
#include "stdlib.h"#include "time.h"struct link{
int data;
struct link *next;};//不带头节点的链表struct link *CreateLink(int n){
struct link *head=NULL,*p=NULL,*q=NULL;
srand( n*1000);
int temp = rand()%10;
head = (struct link *)malloc(sizeof(struct link));
head->data = temp;
head...
回复

使用道具 举报

千问 | 2013-3-28 16:18:53 | 显示全部楼层
#include #include #define null 0typedef struct LNode{ int data ; struct LNode *next ;}LNode , *LinkList;void CreateList_L(LinkList L,int n){ in...
回复

使用道具 举报

千问 | 2013-3-28 16:18:53 | 显示全部楼层
不管你是用什么算法给链表排序的,,都可以用插入排序的方式将第二个链表插入到第一个链表啊,...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行