In this project, interfaces for mathematical Set Theory are implemented using C programming language. User can give the input like two list of data and this program will give the output as the union and intersection of these two lists.
Goals (2 to 3 lines)
Implementation of interface for mathematical Set Theory using C programming.
Giving two list of data as input to get the output as union & intersection for given list of data.
Key Highlights of project:(4 to 5 points)
Creating two list of data using linked list method.
Insert the node to 1st and 2nd list accordingly.
Intersection of data of two lists.
Getting Union of two list.
Deliverables of this project: (4 to 5 points)
Intersection of data of two list.
Union of data of two list.
Expected Outcomes : (4 to 5 points)
Student will get the Knowledge of creating the nodes using Linked List.
Getting the intersection and Union of data of two list.
printf("Enter the number of nodes in first list: ");
fflush(stdout);
scanf("%d",&first_list_nodes);
printf("Enter %d the element : ",first_list_nodes); //getting the number of element in the lists
for (f=0; f
{
scanf("%d",&first_list_items); //getting the data in run time
head1 = insert_node(head1,first_list_items); //inserting the data in list
}
display_list(head1); //displating the head 1 list
printf("\n Enter the Number of Nodes in second list : ");
fflush(stdout);
scanf("%d",&second_list_nodes);
printf("Enter %d the element : ",second_list_nodes);
for (f=0; f
{
scanf("%d",&second_list_items); //getting the data in run time
head2 = insert_node(head2,second_list_items);
}
display_list(head2); //displating the head 2 list
res_union = get_union(head1,head2); //Transfering the result of union function to the res union
printf("Here is the result of union : ");
display_list(res_union); //transferring the values asargument to display function
res_intersection = get_intersection(head1, head2); //Transfering the result of intersection function to the res intersection
printf("Here is the result of intersection : "); //transferring the result of intersection function to the res intersection
display_list( res_intersection); //transferring the values asargument to display function
}
Output:
Enter the number of nodes in first list: 4 7 3 6 7 Enter 4 the element : Inserting element the beginning.... Address of creating new node : 13245888 inserting value is : 7
Inserting element the beginning.... Address of creating new node : 13245904 inserting value is : 3
Inserting element the beginning.... Address of creating new node : 13245920 inserting value is : 6
Inserting element the beginning.... Address of creating new node : 13245936 inserting value is : 7 7 6 3 7 Enter the Number of Nodes in second list : 3 5 6 7 Enter 3 the element : Inserting element the beginning.... Address of creating new node : 13245952 inserting value is : 5
Inserting element the beginning.... Address of creating new node : 13246056 inserting value is : 6
Inserting element the beginning.... Address of creating new node : 13246072 inserting value is : 7 7 6 5 Inserting element the beginning.... Address of creating new node : 13246088 inserting value is : 7
Inserting element the beginning.... Address of creating new node : 13246104 inserting value is : 6
Inserting element the beginning.... Address of creating new node : 13246120 inserting value is : 3
Inserting element the beginning.... Address of creating new node : 13246136 inserting value is : 7
Inserting element the beginning.... Address of creating new node : 13246152 inserting value is : 5 Here is the result of union : 5 7 3 6 7 Inserting element the beginning.... Address of creating new node : 13246168 inserting value is : 7
Inserting element the beginning.... Address of creating new node : 13246184 inserting value is : 6
Inserting element the beginning.... Address of creating new node : 13246200 inserting value is : 7 Here is the result of intersection : 7 6 7