1. 程式人生 > >資料結構與演算法分析-C語言描述 3.2

資料結構與演算法分析-C語言描述 3.2

資料結構與演算法分析-C語言描述 3.2  PrintLots

#include "stdafx.h"
#include"List.h"

int main()
{
	List L, P;
	L = CreatedList();
	P = CreatedList();
	PrintLots(L, P);
    return 0;
}

//3.2
void PrintLots(List L, List P) {
	Position l_pos, p_pos;
	l_pos = L;
	p_pos = P;
	int i = 1;
	while (p_pos != NULL&&l_pos != NULL) {
		int num = Retrieve(p_pos);
		for (; i < num; i++) {
			l_pos = Advance(l_pos);
		}
		printf("%d\n", Retrieve(l_pos));
		p_pos = Advance(p_pos);
	}
}