/* * ====================================================================== * Test Set Operations on Numerically Ordered Linked Lists * * Copyright (C) 1993-96 by Mark Austin and David Mazzoni. * * This software is provided "as is" without express or implied warranty. * Permission is granted to use this software on any computer system, * and to redistribute it freely, subject to the following restrictions: * * 1. The authors are not responsible for the consequences of use of * this software, even if they arise from defects in the software. * 2. The origin of this software must not be misrepresented, either * by explicit claim or by omission. * 3. Altered versions must be plainly marked as such, and must not * be misrepresented as being the original software. * 4. This notice is to remain intact. * * Written by: Mark Austin July, 1993 * ====================================================================== */ #include #include "numlist.h" #include "miscellaneous.h" int main( void ) { NUMLIST *spList1, *spList2, *spList3; /* [a] : Build first linked list */ spList1 = listAddItem( (NUMLIST *) NULL, 1.0); spList1 = listAddItem( spList1, 5.0); spList1 = listAddItem( spList1, 2.0); spList1 = listAddItem( spList1, 4.0); spList1 = listAddItem( spList1, 16.0); spList1 = listAddItem( spList1, 3.0); spList1 = listAddItem( spList1, 8.0); spList2 = listAddItem( (NUMLIST *) NULL, -1.0); spList2 = listAddItem( spList2, 2.0); spList2 = listAddItem( spList2, 4.0); spList2 = listAddItem( spList2, -3.0); spList2 = listAddItem( spList2, 16.0); /* [b] : Print a second linked list */ listPrint( "First Linked List", spList1 ); listPrint( "Second Linked List", spList2 ); /* [c] : Compute and Print Intersection of Oneway Linked Lists */ spList3 = listIntersection( spList1, spList2 ); listPrint( "Intersection", spList3 ); }