数据结构实现将两个数组合并成一个数组

vs2013数据结构实现将两个数组合并成一个数组

#include
#include
#include
struct LinearList
{
	int * list;
	int size;
	int MaxSize;
};
int main()
{
	int list1[15] = { 2, 5, 7, 8, 10, 14, 19, 22, 25, 30 };
	int list2[15] = { 3, 5, 8, 9, 11, 18, 22, 28, 30, 32, 35 };
	int list3[30];
	struct LinearList L1 = { list1, 10, 15 };
	struct LinearList L2 = { list2, 11, 15 };
	struct LinearList L3 = { list3, 0, 30 };
	int i, j, k;
	for (i = j = k = 0; kL2.list[j])
			L3.list[k] = L2.list[j++];
		else if (L1.list[i] == L2.list[j])
		{
			L3.list[k] = L1.list[i++];
			j++;
		}
		else
			L3.list[k] = L1.list[i++];
	}
	while(k


你可能感兴趣的:(数据结构)