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} 0 1 2 3 4 5 elements 15 20 count Implement the following functions given the definition: //Set is just an alias for int (MAX) //Set means an array of integers typedef int Set (MAX) ; void initialise (int *count); simply set count to 0 void display (Set , 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, count2); - store in the array result the set resulting from the union of s1 and s2 Set 2, int 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 xis an element of s1 intersection s2 if x is an element of s1 and x is an element of s2 void difference (Set result, int *count, Set s1,int countl, Set s2, int count2); - store in the array result the set resulting from the 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 void symmetziedifference (Set result, int *count, Set s1, int countl, Set s2, 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 int subset (Set sl, int countl, Set s2, int count2); - si is a subset of s2 if all elements of s1 are in s2 int disjoint (Set sl, int countl, Set 2, 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
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} 0 1 2 3 4 5 elements 15 20 count Implement the following functions given the definition: //Set is just an alias for int (MAX) //Set means an array of integers typedef int Set (MAX) ; void initialise (int *count); simply set count to 0 void display (Set , 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, count2); - store in the array result the set resulting from the union of s1 and s2 Set 2, int 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 xis an element of s1 intersection s2 if x is an element of s1 and x is an element of s2 void difference (Set result, int *count, Set s1,int countl, Set s2, int count2); - store in the array result the set resulting from the 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 void symmetziedifference (Set result, int *count, Set s1, int countl, Set s2, 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 int subset (Set sl, int countl, Set s2, int count2); - si is a subset of s2 if all elements of s1 are in s2 int disjoint (Set sl, int countl, Set 2, 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
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Topic Video
Question
C
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!
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education