Program to generate Cantor ternary set
More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Program to generate Cantor ternary set
◆ free_memory()
Clear memory allocated by propagate function.
- Parameters
-
head | pointer to first allocated instance. |
◆ print()
Print sets in the current range to stdout
- Parameters
-
head | pointer to first set in the current level |
61 printf(
"[%lf] -- ", temp->start);
62 printf(
"[%lf]", temp->end);
◆ propagate()
Iterative constructor of all sets in the current level.
This function dynamically allocates memory when creating new sets. These are freed by the function free_memory.
- Parameters
-
head | pointer to interval set instance to update |
35 double diff = (((temp->end) - (temp->start)) / 3);
39 temp->end = ((temp->start) + diff);