#include <stdlib.h>
#include "slist.h"
Go to the source code of this file.
◆ SlAddNodeToTail()
Add a node to the list tail. Runs in O(n) time.
- Parameters
-
Head | A pointer to the existing list head. |
Node | A pointer to the node you are adding. |
Definition at line 44 of file slist.c.
◆ SlInsertNodeAfter()
Inserts a new node into the list right after the marker element. Runs in O(1) time.
- Parameters
-
Marker | The node you are inserting after. Cannot be NULL. |
Node | The node you are inserting. Cannot be NULL. |
Definition at line 68 of file slist.c.
◆ SlInsertNodeBefore()
Inserts a new node into the list right before the marker element. Runs in O(n) time.
- Parameters
-
Head | Pointer to the list head. |
Marker | Node you are inserting before. Cannot be NULL. |
Node | The node you are inserting. Cannot be NULL. |
Definition at line 87 of file slist.c.
◆ SlRemoveNode()
Removes a node from the list. Runs in O(n) time worst case.
- Parameters
-
Head | Pointer to the list head. |
Node | The node you are removing. |
Definition at line 127 of file slist.c.
◆ SlRemoveNodeFromHead()
Removes the node from the list head. Runs in O(1) time.
- Parameters
-
Head | A pointer to the existing list head. |
- Returns
- The node removed, or NULL for an empty list.
Definition at line 162 of file slist.c.
◆ SlRemoveNodeFromTail()
Removes the node from the list tail. Runs in O(n) time.
- Parameters
-
Head | A pointer to the existing list head. |
- Returns
- The node removed, or NULL for an empty list.
Definition at line 181 of file slist.c.