Laboratory work on an academic subject: "Programming dynamic data structures"
- Laboratory work 1
1.1. Creating an empty set
1.2. Checking for an empty set
1.3. Checking whether an element belongs to a set
1.4. Adding a new element to the set
1.5. The power of the set
1.6. Creating a set
1.7. Output of elements of the set
1.8. Deleting a set (clearing the memory occupied by the list)
A singly connected list of integer values is used to represent the set. OOP is not applied due to restrictions on the terms of reference
File name | File Contents |
---|---|
Lab1_12_Kudashov.cpp | Main program |
SetLab1_12_Kudashov.h | Function set header file |
SetLab1_12_Kudashov.cpp | Function set implementation file |
Input parameters: None.
Output parameters: a pointer to the first element of the list, equal to NULL.
Input parameters: a pointer to the first item in the list.
Output parameters: Boolean value.
Checking whether an element belongs to a set - bool checkingOfExistence(Node* first, int checking_value)
Input parameters: a pointer to the first element of the list, the value of the element.
Output parameters: Boolean value.
Input parameters: a pointer to the first element of the list, a value to be added to the list.
Output parameters: a pointer to the first element of the result list.
Restriction: Adding an item to the top of the list.
Input parameters: a pointer to the first item in the list.
Output parameters: integer value.
Input parameters: the number of elements, the range of acceptable values (from min to max). k is the multiplicity coefficient for checking the satisfaction of the condition.
Output parameters: a pointer to the first element of the result list. Generation of values by a random number sensor.
Requirement: check the possibility of creating a set with the specified parameters.
Input parameters: a pointer to the first element of the list, a separator character.
Output parameters: a string containing elements of a set separated by a separator character.
Requirements: there should not be a separator at the end of the result line.
Input parameters: a pointer to the first item in the list.
Output parameters: a pointer to the first element of the list, equal to NULL.