
数据结构
不折腾就闹心
这个作者很懒,什么都没留下…
展开
-
合并两个线性表
数据结构中合并两个线性表的伪代码void unionab(List * La,List * Lb){ int alen,blen,i=0; ElemType e;//声明类型相同的元素 alen=ListLength(*La); blen=ListLength(*Lb); for(int j = 1 ; j <= blen;j++){ GetE原创 2017-09-05 16:46:42 · 2055 阅读 · 0 评论 -
单链表的读取插入删除
1单链表的读取 声明一个指针P指向链表中的第一个结点,初始化j从1开始; 当jStatus GetElem(LinkList L, int i, ElemType *e){ LinkList p; p=L->next; int j=1; while(p && j<i){ p=p->next; ++j; } if(!p || j>i原创 2017-09-06 16:45:35 · 431 阅读 · 0 评论 -
cvte笔试题
输入:hello world 输出: world hello#include <stdio.h>#include <string.h>int main(){char s[3000],c[1000][20]={0};//c[j]来储存单词,k是单词中的字母int i,j=0,k=0;gets(s);for(i=0; i<strlen(s); i++){if(s[i]==' '){原创 2017-09-07 20:33:10 · 1320 阅读 · 0 评论 -
寻找k个数组的最小区间
有k个有序的数组,请找到一个最小的数字范围。使得这k个有序数组中,每个数组都至少有一个数字在该范围中。 例如:1: 4, 10, 15, 24, 262: 0, 9, 12, 203: 5, 18, 22, 30所得最小范围为[20,24],其中,20在2中,22在3中,24在1中。通过归并排序的思想,确保每次都是k个来自不同的数组的元素进行比较,得到最大值、最小值。就可以得到一个范围,包含了所有原创 2017-09-17 15:31:01 · 1811 阅读 · 0 评论