diff options
Diffstat (limited to '')
| -rw-r--r-- | src/cycle_detection.h | 7 | ||||
| -rw-r--r-- | src/graph.h | 8 | ||||
| -rw-r--r-- | src/linked_list.h | 13 | ||||
| -rw-r--r-- | src/vector.h | 7 |
4 files changed, 13 insertions, 22 deletions
diff --git a/src/cycle_detection.h b/src/cycle_detection.h index e5e0220..9914435 100644 --- a/src/cycle_detection.h +++ b/src/cycle_detection.h @@ -17,9 +17,10 @@ * @param g Pointer to the directed graph to analyze. * Must not be NULL. * - * @details Prints to stdout whether the given graph has a cycle. In that case - * in prints 'CYCLE DETECTED!', else it prints the graph in - * topological sorting i.e. '4, 0, 1, 3, 2'. + * @details Prints to stdout whether the given graph has a cycle; + * in that case in prints 'CYCLE DETECTED!', + * else it prints the graph in topological sorting + * i.e. '4, 0, 1, 3, 2'. * * @note The input graph @p g may be modified during execution. The function * alters vertex in-degree counts and neighbor lists as part of the diff --git a/src/graph.h b/src/graph.h index ca9f32a..00d4d6c 100644 --- a/src/graph.h +++ b/src/graph.h @@ -2,8 +2,7 @@ * @file graph.h * @brief Directed graph implementation using adjacency lists. * @details This module provides a directed graph data structure where each - * vertex maintains separate lists of outgoing and incoming neighbors, - * enabling efficient navigation in both directions. + * vertex maintains separate lists of outgoing and incoming neighbors. */ #ifndef GRAPH_H @@ -79,9 +78,7 @@ struct Graph { /** * @brief Array of all vertices in the graph. * @details An array of size num_vertices containing Vertex structures. - * Index i contains the vertex with id = i. The array is - * dynamically allocated and should be freed by the caller - * when the graph is no longer needed. + * Index i contains the vertex with id = i. */ Vertex *vertices; }; @@ -133,7 +130,6 @@ Graph *graph_read(const char *filename); * @brief Deallocates the given graph and all its associated memory. * * @param g Pointer to the graph to delete. - * If NULL, this function does nothing. */ void graph_delete(Graph *g); diff --git a/src/linked_list.h b/src/linked_list.h index 0da0c25..2a0939f 100644 --- a/src/linked_list.h +++ b/src/linked_list.h @@ -2,8 +2,7 @@ * @file linked_list.h * @brief Doubly-linked list implementation. * @details This module provides a generic doubly-linked list data structure - * that can store pointers to any data type. The list maintains both - * head and tail pointers for efficient operations at both ends. + * that can store pointers to any datatype. */ #ifndef LINKED_LIST_H @@ -69,8 +68,7 @@ struct LinkedListNode { /** * @brief Generic pointer to the node's data. * @details The caller is responsible for managing the memory - * pointed to by this pointer. This pointer can store any - * data type (int*, char*, struct*, etc.). + * pointed to by this pointer. */ void *data; }; @@ -89,8 +87,7 @@ LinkedList *linked_list_new(); /** * @brief Deallocates the given linked list and all its nodes. * - * @param ll Pointer to the linked list to delete. If NULL, this function - * does nothing. + * @param ll Pointer to the linked list to delete. If NULL. * * @note This function deallocates only the list structure and nodes, not * the data they point to. The caller retains ownership of the data. @@ -117,9 +114,7 @@ LinkedListNode *linked_list_append(LinkedList *ll, void *elem); * * @param ll Pointer to the linked list. * - * @return The data pointer of the removed first element. - * - * @pre The list must not be empty (ll->size != 0). + * @return The data pointer of the removed first element, or NULL if empty. */ void *linked_list_popfront(LinkedList *ll); diff --git a/src/vector.h b/src/vector.h index 7320442..7deb8d3 100644 --- a/src/vector.h +++ b/src/vector.h @@ -2,8 +2,8 @@ * @file vector.h * @brief Dynamic array (vector) implementation. * @details This module provides a generic resizable array data structure - * that can store pointers to any data type. The vector automatically - * grows as elements are added, using a growth factor to amortize + * that can store pointers to any datatype. The vector automatically + * grows as elements are added, using a growth factor to mediate * reallocation costs. */ @@ -14,7 +14,7 @@ /** * @def VECTOR_INITIAL_CAPACITY - * @brief Initial capacity of a newly created vector. + * @brief Initial capacity of a vector. * @details The vector will be allocated with space for this many elements * when first created. This value is chosen to balance memory usage * and the number of early reallocations. @@ -26,7 +26,6 @@ * @brief Multiplicative factor for vector capacity growth. * @details When the vector reaches capacity and needs to grow, the new * capacity is calculated as (current_capacity * GROWTH_FACTOR). - * A factor of 2 provides good amortized performance. */ #define VECTOR_GROWTH_FACTOR 2 |