Welcome to the SetOperator program, a specialized tool designed to manage and manipulate sets in computing. In the realm of mathematics, particularly in Set Theory, a set is a fundamental concept representing a collection of distinct objects, each referred to as an element. The pivotal relationship in set theory is the membership relation, which establishes whether an element belongs to a specific set or not. Sets have a wide range of applications in computer systems, featuring prominently in various programming languages as a Data Structure (DS) and in solving mathematical, optimization, and statistical problems.
The primary objective of SetOperator is to implement the Abstract Data Type (ADT) for sets in such a way that the chosen Data Structure facilitates the execution of specific operations with the lowest possible computational complexity. The program focuses on two categories of operations:
- Create: Initialize a new set.
- Delete: Remove an existing set.
- Insert: Add an element to a set.
- Remove: Delete an element from a set.
- Print: Display the elements/items stored in the ADT.
- Membership: Determine whether an element is present in a set.
- Union: Combine two sets into one, containing all the elements from both sets.
- Intersection: Create a set containing only the elements common to two sets.
To use SetOperator, follow the instructions below:
- GCC (GNU Compiler Collection)
- Make
-
Clone the repository
git clone https://github.com/lfelipediniz/SetOperator.git
-
Navigate to the project directory
cd SetOperator
You can test the program manually through the Makefile
-
Give permission for the script to become executable
make
-
Execute the program (with either of the two commands)
make run
-
To delete the generated files run
make clean
Or use the sh script that runs all test cases present in the test folder, indicating which cases passed
-
Compile and run the program using the provided Makefile
sudo chmod +x runTests.sh
-
Execute the case tests
./runTests.sh
To manage sets effectively, users have access to a variety of commands. Each command is to be used within code blocks for clarity. Here’s a breakdown of these commands:
-
Create a new set
create-set <set name>
-
Delete an existing set
delete-set <set name>
-
Add a numeric item to the set
addItem-set <set name> <item>, <item2>
-
Remove a numeric item to the set
removeItem-set <set name> <item>, <item2>
-
Check if an item belongs to the set
belong-set <set name> <item>
-
Create a new set from the union of two others
union-set <set1 name> <set2 name> <union set name>
-
Create a new set from the intersection of two others
intersection-set <set1 name> <set2 name> <intersection set name>
All test cases are in the test folder
| Names | USP Number |
|---|---|
| Luiz Felipe Diniz Costa | 13782032 |
| Nicolas Carreiro Rodrigues | 14600801 |
Project for the course "Algorithm and Data Structure" at the Institute of Mathematics and Computer Science, University of Sao Paulo