-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinked-List-Node.h
More file actions
65 lines (53 loc) · 2.95 KB
/
Linked-List-Node.h
File metadata and controls
65 lines (53 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
struct Node;
typedef struct Node Node;
struct ListNodeNode
{
struct Node* address;
struct ListNodeNode *next;
};
typedef struct ListNodeNode ListNodeNode;
/// @brief Adds provided address at the end of the list.
/// @param list The pointer to the first node of the list.
/// @param address The address to be added at the end of the list.
/// @return The address of the first node of the list.
ListNodeNode* listNodeAdd(ListNodeNode* list, Node* address);
/// @brief Adds provided address in the list at the given index.
/// @param list The pointer to the first node of the list.
/// @param address The address to be added in the list.
/// @param index The index at which the address must be added.
/// @return The address of the first node of the list.
ListNodeNode* listNodeAddAtIndex(ListNodeNode* list, Node* address, int index);
/// @brief Adds provided address at the beginning of the list.
/// @param list The pointer to the first node of the list.
/// @param address The address to be added in the list.
/// @return The address of the first node of the list.
ListNodeNode* listNodeAddBeginning(ListNodeNode* list, Node* address);
/// @brief Updates the old address in the list with the new address provided.
/// @param list The pointer to the first node of the list.
/// @param oldNode The address to be updated in the list.
/// @param newNode The update address.
/// @return The address of the first node of the list.
ListNodeNode* listNodeUpdate(ListNodeNode* list, Node* oldNode, Node* newNode);
/// @brief Removes first occurence of the provided address from the list, if it is present.
/// @param list The pointer to the first node of the list.
/// @param address The address to be removed from the list.
/// @return The address of the first node of the list or NULL if list is empty.
ListNodeNode* listNodeRemove(ListNodeNode* list, Node* address);
/// @brief Finds the provided address in the list, if it is present.
/// @param list The pointer to the first node of the list.
/// @param address The address to be found in the list.
/// @return The address of the node that contains the address provided or NULL if the address doen not exist in list.
ListNodeNode* listNodeFind(ListNodeNode* list, Node* address);
/// @brief A function to get the last node of the list.
/// @param list The pointer to the first node of the list.
/// @return The last node of the list or NULL if list is empty(NULL).
ListNodeNode* getLastNodeNode(ListNodeNode* list);
/// @brief A function to get the node at specified index in the list.
/// @param list The pointer to the first node of the list.
/// @param index The index of the wanted node.
/// @return The node at the specified index, or NULL if list is empty or index is out of bounds.
ListNodeNode* getIndexNodeNode(ListNodeNode* list, int index);
/// @brief A function to get the count of nodes in a list.
/// @param list The pointer to the first node of the list.
/// @return The number of nodes in the list.
int getNodeCount(ListNodeNode* list);