Challenge

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

Aim: To implement Set operations using linked list.

Theory: Set Operation

Union : Union refers to merging of two sets which maybe same or different. All the elements are unique in a set. Union is represented by "U". Union gives maximum number of elements.For example: A = {1,2,3,4,5} B = {3,4,5,7,8,9}

A U B = {1,2,3,4,5,7,8,9} .

Intersection: In intersection of sets common element is obtained from the sets . Intersection gives the minimum number of elements. It is represented by " ∩ "

A = {1,2,3,4,5} B = {3,4,5,7,8,9}

A ∩ B = {3,4,5}.

Logic for Union and intersection

For union traverse the set and insert all the elements from one set to another. Insert those elments which are not present in first set.

For intersection,traverse the set and check for the elements which are common to the sets.

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.