# 4. Task and order of execution / Завдання та порядок виконання > **Source of tasks.** The requirements below are taken **exactly** from the > assignment *"Lab #1: Basic Set Operations"*. Implement the functions with the > specified behaviour; the input/output examples are authoritative. ## Objective Implement foundational set operations **without using pre-built libraries or classes**. ## Requirements - Sets can contain **integers, strings, or any data type**. - **Do not use built-in set classes or their methods.** Examples: - **C#** — avoid `HashSet` - **Python** — do not use `set()` - **Java** — avoid `HashSet` - **JavaScript** — do not use `Set` - …and so on for other languages. ## Order of execution Implement the tasks tier by tier, and test each function against its examples before proceeding to the next. Your score corresponds to the **highest tier** that is fully and correctly implemented. ## Tasks ### Tier 1 — Set creation and manipulation (Score: 60–74) | Function | Behaviour | Example input | Example output | |---|---|---|---| | `createSet(elements)` | Create a set from a list of elements, removing any duplicates. | `[1,2,2,3]` | `[1,2,3]` | | `addElement(set, element)` | Add an element to the set if it is not already present. | `([1,2,3], 4)` | `[1,2,3,4]` | | `removeElement(set, element)` | Remove an element if it exists in the set. | `([1,2,3,4], 4)` | `[1,2,3]` | | `containsElement(set, element)` | Return a boolean indicating whether an element is present. | `([1,2,3], 4)` | `False` | ### Tier 2 — Advanced set operations (Score: 75–89) | Function | Behaviour | Example input | Example output | |---|---|---|---| | `union(setA, setB)` | Return a new set that is the union of the two sets. | `([1,2,3], [3,4,5])` | `[1,2,3,4,5]` | | `intersection(setA, setB)` | Return a new set that is the intersection of the two sets. | `([1,2,3], [3,4,5])` | `[3]` | | `difference(setA, setB)` | Return a set of elements in `setA` but not in `setB`. | `([1,2,3], [3,4,5])` | `[1,2]` | | `complement(setA, universalSet)` | Return the complement of `setA` relative to a universal set. | `([1,2,3], [1,2,3,4,5])` | `[4,5]` | ### Tier 3 — Expression evaluator (Score: 90–100) `evaluateExpression(expression, setsDict)` — given a string expression and a dictionary of sets, compute the result of the expression. **Example** - Expression: `"A intersection B union C"` - `setsDict = {'A': [1,2,3], 'B': [3,4,5], 'C': [5,6,7]}` - Output: `[3,5,6,7]`