Challenge

Project 1 - Creation of user defined data type to implement the user interfaces for working with ‘Set’ (Mathematical Set theory)

/*
* main.c
*
* Created on: 28-Jun-2022
* Author: Abhinav Kumar
*/

#include"project.h"

//adding a node before the head
struct node *head1 = NULL;
struct node *head2 = NULL;

int main()
{
//adding nodes as a head to list head1 i.e. new node will have the address of head1
addNodehead(4,&head1);
addNodehead(3,&head1);
addNodehead(2,&head1);
addNodehead(1,&head1);

//printf("\nthe first list is:");
//printList(head1);

//adding nodes as a tail to list head1 i.e. tail will have the address of new node
addNodetail(5,&head1);
addNodetail(6,&head1);
addNodetail(7,&head1);
addNodetail(8,&head1);

//printf("\nthe first modified list is:");
// printList(head1);

//adding nodes as a head to list head2 i.e. new node will have the address of head2
addNodehead(12,&head2);
addNodehead(18,&head2);
addNodehead(10,&head2);
addNodehead(24,&head2);

//display the results
/*printf("\nthe second list is:");
printList(head2);*/

//adding nodes as a tail to list head2 i.e. tail will have the address of new node
addNodetail(16,&head2);
addNodetail(1,&head2);
addNodetail(7,&head2);
addNodetail(9,&head2);

//display the added nodes

/*printf("\nthe second modified list is:");
printList(head2);*/


//shortlisting in acending order
shortlist(head2);

//display the result
/*printf("\nthe shorted second modified list is:");
printList(head2);*/

//adding a node without disturbing the order
addNodetail(100,&head2);
//display the result
/*printf("\nthe shorted second modified list is:");
printList(head2);*/


/* a = searchdata(99, head2);
printf("\n%d",a);*/


printf("The first list is:");
printList(head1);
printf("\nThe second list is:");
printList(head2);

unionoflist(head1,head2);
intersectionoflist(head1,head2);
return 0;
}

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.