element of si intersection s2 if Xis an element or si and x is an element or froid difference (Set result, int *count, Set sl, int countl, Set s2,int count2); store in the array result the set resulting from the difference of s1 and s2 x is an element of s1-s2 if x is an element of s1 and x is not an element of s2 Kroid symmetricdifference (Set result, int *count, Set sl, int countl, Set 2, int count2); store in the array result the set resulting from the symmetric difference of s1 and s2 xis an element of s1 - s2 if x is an element of s1 and x is not an element of s2 and vice versa subset (Set sl,int countl, Set s2,int count2) ; s1 is a subset of s2 if all elements of s1 are in s2

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

C Programming - Arrays (Part 2/3)

Hello, since this is a multipart question, as per the policy, I have specified these three parts. Thank you so much for helping me out!

A set of integers may be implemented using an array of integers. Since the array is only partially filled,
it is important to store the number of elements contained in the array. The program contains the array
itself and another integer to store the actual number of elements in the set.
To illustrate, given a set s= {3, 8, 15, 20}
1
2
3
4
5
6
elements
15
20
count
4
Implement the following functions given the definition:
typedef int Set (MAX);
//Set is just an alias for int [MAX)
//Set means an array of integerS
void initialise (int*count);
simply set count to o
void display (Set s, int count);
-
display on the screen all valid elements of the array, from 0.count-1
-
void add (Set s, int * count, int elem);
simply store elem in the array indexed by count then increment count
int contains (Set s, int count, int elem);
search the array elements for the value elem
-
void getUnion (Set result, int *count, Set sl, int countl,
Set s2, int
count2);
store in the array result the set resulting from the union of s1 and s2
- xis an element of s1 union s2 if x is an element of s1 or x is an element of s2
void intersection (Set result, int *count, Set s1, int countl, Set s2, int
count2);
- store in the array result the set resulting from the intersection of s1 and s2
x is an element of s1 intersection s2 if x is an element of s1 and x is an element of s2
froid difference (Set result, int *count, Set sl,int countl, Set s2, int
count2);
store in the array result the set resulting from the difference of s1 and s2
x is an element of s1 - s2 if x is an element of s1 and x is not an element of s2
toid symmetricdifference (Set result, int *count, Set sl, int countl, Set
52, int count2);
store in the array result the set resulting from the symmetric difference of s1 and s2
x is an element of s1 - s2 if x is an element of s1 and x is not an element of s2 and vice versa
tht subset (Set sl, int countl, Set s2, int count2);
s1 is a subset of s2 if all elements of s1 are in s2
int disjoint (Set sl, int countl, Set s2, int count2);
two sets are disjoint if the intersection is empty
int equal (Set sl, int countl, Set s2, int count2);
two sets are equal if they have exactly the same elements
-
Project name: SetArray
Filenames: set.h, set.c, main.c
00
Transcribed Image Text:A set of integers may be implemented using an array of integers. Since the array is only partially filled, it is important to store the number of elements contained in the array. The program contains the array itself and another integer to store the actual number of elements in the set. To illustrate, given a set s= {3, 8, 15, 20} 1 2 3 4 5 6 elements 15 20 count 4 Implement the following functions given the definition: typedef int Set (MAX); //Set is just an alias for int [MAX) //Set means an array of integerS void initialise (int*count); simply set count to o void display (Set s, int count); - display on the screen all valid elements of the array, from 0.count-1 - void add (Set s, int * count, int elem); simply store elem in the array indexed by count then increment count int contains (Set s, int count, int elem); search the array elements for the value elem - void getUnion (Set result, int *count, Set sl, int countl, Set s2, int count2); store in the array result the set resulting from the union of s1 and s2 - xis an element of s1 union s2 if x is an element of s1 or x is an element of s2 void intersection (Set result, int *count, Set s1, int countl, Set s2, int count2); - store in the array result the set resulting from the intersection of s1 and s2 x is an element of s1 intersection s2 if x is an element of s1 and x is an element of s2 froid difference (Set result, int *count, Set sl,int countl, Set s2, int count2); store in the array result the set resulting from the difference of s1 and s2 x is an element of s1 - s2 if x is an element of s1 and x is not an element of s2 toid symmetricdifference (Set result, int *count, Set sl, int countl, Set 52, int count2); store in the array result the set resulting from the symmetric difference of s1 and s2 x is an element of s1 - s2 if x is an element of s1 and x is not an element of s2 and vice versa tht subset (Set sl, int countl, Set s2, int count2); s1 is a subset of s2 if all elements of s1 are in s2 int disjoint (Set sl, int countl, Set s2, int count2); two sets are disjoint if the intersection is empty int equal (Set sl, int countl, Set s2, int count2); two sets are equal if they have exactly the same elements - Project name: SetArray Filenames: set.h, set.c, main.c 00
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY