aboutsummaryrefslogtreecommitdiff
path: root/include/lib/algo
diff options
context:
space:
mode:
Diffstat (limited to 'include/lib/algo')
-rw-r--r--include/lib/algo/avl_tree.h26
-rw-r--r--include/lib/algo/flood_fill.h7
2 files changed, 18 insertions, 15 deletions
diff --git a/include/lib/algo/avl_tree.h b/include/lib/algo/avl_tree.h
index 0221952..18cf34b 100644
--- a/include/lib/algo/avl_tree.h
+++ b/include/lib/algo/avl_tree.h
@@ -9,44 +9,44 @@
#define AvlHeight_t uint8_t
-typedef bool_t (*AvlComparator)(void*, void*);
+typedef bool_t (*AvlComparator)(void *, void *);
typedef struct AVLNode {
- void* data;
+ void *data;
AvlComparator compare;
- struct AVLNode* left;
- struct AVLNode* right;
+ struct AVLNode *left;
+ struct AVLNode *right;
AvlHeight_t height;
} AVLNode;
// Get the height of an AVL node
-AvlHeight_t get_height(AVLNode* node);
+AvlHeight_t get_height(AVLNode *node);
// Get the Maximum Height between two
AvlHeight_t max_height(AvlHeight_t a, AvlHeight_t b);
// Get the balance factor of a node
-ssize_t get_balance_factor(AVLNode* node);
+ssize_t get_balance_factor(AVLNode *node);
// Rotate an AVL node right
-AVLNode* right_rotate(AVLNode* parent);
+AVLNode *right_rotate(AVLNode *parent);
// Rotate an AVL node left
-AVLNode* left_rotate(AVLNode* parent);
+AVLNode *left_rotate(AVLNode *parent);
// Create AVL node
-AVLNode* create_avl_node(void* data, AvlComparator compare);
+AVLNode *create_avl_node(void *data, AvlComparator compare);
// Insert data into AVL tree
-Result avl_insert(AVLNode* node, void* data, AvlComparator compare);
+Result avl_insert(AVLNode *node, void *data, AvlComparator compare);
// In-order traversal print pointer
-void print_in_order(AVLNode* root);
+void print_in_order(AVLNode *root);
// Free avl tree nodes starting at root
-void free_avl_tree(AVLNode* root);
+void free_avl_tree(AVLNode *root);
// Free avl tree and their data starting at root
-void free_avl_tree_nodes(AVLNode* root);
+void free_avl_tree_nodes(AVLNode *root);
#endif
diff --git a/include/lib/algo/flood_fill.h b/include/lib/algo/flood_fill.h
index f446e3b..3bacaf9 100644
--- a/include/lib/algo/flood_fill.h
+++ b/include/lib/algo/flood_fill.h
@@ -12,9 +12,12 @@
// 1. Check that the (x,y) is within the picture
// 2. Check if the (x,y) coordinate in the mask is unused
// 3. Check if the (x,y) coordinate in the image is non-background
-// 4. Check if the (x,y) coordinate in the image is the same color as the fill color
+// 4. Check if the (x,y) coordinate in the image is the same color as the fill
+// color
// 5. If all hold, set the label for the pixel, and check each neighbor
// Otherwise, stop flooding
-bool_t flood(ImageData_t* image, MaskData_t* mask, size_t width, size_t height, size_t channels, size_t x, size_t y, ImageData_t* fill_color, MaskData_t label);
+bool_t flood(ImageData_t *image, MaskData_t *mask, size_t width, size_t height,
+ size_t channels, size_t x, size_t y, ImageData_t *fill_color,
+ MaskData_t label);
#endif