C Fundamentals
Algorithms · data structures · cryptography · systems — pure C11, zero deps
Loading...
Searching...
No Matches
linked_list.c File Reference
#include "linked_list.h"
#include <stdlib.h>

Go to the source code of this file.

Functions

linked_list_tll_create (void)
 
void ll_destroy (linked_list_t *list)
 
size_t ll_find (const linked_list_t *list, int value)
 
bool ll_is_empty (const linked_list_t *list)
 
bool ll_pop_front (linked_list_t *list, int *out_value)
 
bool ll_push_back (linked_list_t *list, int value)
 
bool ll_push_front (linked_list_t *list, int value)
 
void ll_reverse (linked_list_t *list)
 
size_t ll_size (const linked_list_t *list)
 

Function Documentation

◆ ll_create()

linked_list_t * ll_create ( void  )

Definition at line 8 of file linked_list.c.

References linked_list_t::head, and linked_list_t::size.

Referenced by main().

◆ ll_destroy()

void ll_destroy ( linked_list_t list)

Definition at line 16 of file linked_list.c.

References linked_list_t::head, and ll_node::next.

Referenced by main().

◆ ll_find()

size_t ll_find ( const linked_list_t list,
int  value 
)

Returns the index of value, or (size_t)-1 if missing.

Definition at line 66 of file linked_list.c.

References linked_list_t::head, and LL_NOT_FOUND.

Referenced by main().

◆ ll_is_empty()

bool ll_is_empty ( const linked_list_t list)

Definition at line 79 of file linked_list.c.

References linked_list_t::size.

◆ ll_pop_front()

bool ll_pop_front ( linked_list_t list,
int *  out_value 
)

Definition at line 56 of file linked_list.c.

References linked_list_t::head, ll_node::next, linked_list_t::size, and ll_node::value.

◆ ll_push_back()

bool ll_push_back ( linked_list_t list,
int  value 
)

Definition at line 38 of file linked_list.c.

References linked_list_t::head, ll_node::next, linked_list_t::size, and ll_node::value.

Referenced by main().

◆ ll_push_front()

bool ll_push_front ( linked_list_t list,
int  value 
)

Definition at line 27 of file linked_list.c.

References linked_list_t::head, ll_node::next, linked_list_t::size, and ll_node::value.

◆ ll_reverse()

void ll_reverse ( linked_list_t list)

Reverses the list in place. O(n).

Definition at line 83 of file linked_list.c.

References linked_list_t::head, and ll_node::next.

Referenced by main().

◆ ll_size()

size_t ll_size ( const linked_list_t list)

Definition at line 75 of file linked_list.c.

References linked_list_t::size.

Referenced by print_list().