二.求字符串出现次数最多的一个子串,串插入函数.
三.两个有序的单链表的归并算法....
现在哪个有空帮帮忙做一下这三个算法好吗??
谢谢哈!!!
> 一.利用线性表的基本操作实现两个元素交换的算法.
Are you saying you are swapping the data of two nodes?
> 二.求字符串出现次数最多的一个子串,串插入函数.
What does it mean by ",串插入函数."? Should it be there?
This could be a single char whihch appears most frequently. Say
"aaabbaaabbbbbbbbbbbbbbbbbbbbbbbbbbbcc"
then,
"b" is the one, or "bb" is the one...
My point is the problem statement is not clear.
> 三.两个有序的单链表的归并算法....
Following code is for two sorted arrays a and b, they are merged into array c.
I would think you can modify it for two sorted singly linked lists.
void merge(int* a, int na, int* b, int nb, int* c)
{
int ai=0, bi=0, ci=0;
while(ai<na && bi<nb) // both a and b are not empty
if(a[ai]<b[bi])
c[ci++] = a[ai++];
else
c[ci++] = b[bi++];
while(ai<na) // a is not empty, but b is
c[ci++] = a[ai++];
while(bi<nb) // a is empty, but b is not
c[ci++] = b[bi++];
}