|
My library
Library for common tasks
|
Functions for working with LinkedList type. More...
#include "types.h"

Go to the source code of this file.
Functions | |
| LinkedList | newLL (const spec_t spec) |
| Allocate a new LinkedList of specified type. More... | |
| LinkedList | chooseNewLLFromArray (const spec_t spec, const void *arr, unsigned int size) |
| Create a LinkedList from an array. More... | |
| void | printLL (const spec_t spec, const LinkedList list) |
| Print contents from a LinkedList. More... | |
| void | appendToLL (LinkedList list,...) |
| Insert an item at the end of a LinkedList. More... | |
| void | appendToLLFromPtr (LinkedList list, const void *element) |
| Insert an item at the end of a LinkedList. More... | |
| void | insertToLL (LinkedList list, unsigned int index,...) |
| Insert an element at a specified position of a LinkedList. More... | |
| void | deleteLL (LinkedList list) |
| Delete a LinkedList. More... | |
| void | getFromLL (LinkedList list, unsigned int index, void *dest) |
| Get an item from a LinkedList. More... | |
| void | setLLItem (LinkedList list, unsigned int index,...) |
| Set value of an element of a LinkedList. More... | |
| void | removeFromLL (LinkedList list, unsigned int index) |
| Remove an item from a LinkedList. More... | |
| void | mergeLL (LinkedList list1, const LinkedList list2) |
| Merge two LinkedList. More... | |
| LinkedList | newLLFromLL (const LinkedList list) |
| Get a copy of a LinkedList. More... | |
| void | sliceLL (LinkedList list, unsigned int begin, unsigned int end) |
| Slice a LinkedList. More... | |
| int | linearSearchLL (LinkedList list,...) |
| Linear search for LinkedList. More... | |
| void * | linearSearchLLPtr (LinkedList list,...) |
| Linear search for LinkedList. More... | |
| byte | areLLEqual (const LinkedList list1, const LinkedList list2) |
| Compare two LinkedList. More... | |
| byte | isInLL (LinkedList list,...) |
| Detect if an element is inside a LinkedList. More... | |
| unsigned int | getLLLength (const LinkedList list) |
| Get the size of a LinkedList. More... | |
| LinkedList | newLLFromCharArray (const char arr[], unsigned int size) |
| Create a LinkedList from a array of chars. More... | |
| LinkedList | newLLFromIntArray (const int arr[], unsigned int size) |
| Create a LinkedList from a array of ints. More... | |
| LinkedList | newLLFromFloatArray (const float arr[], unsigned int size) |
| Create a LinkedList from a array of floats. More... | |
| LinkedList | newLLFromDoubleArray (const double arr[], unsigned int size) |
| Create a LinkedList from an array of doubles. More... | |
| LinkedList | newLLFromPtrArray (const void *arr, unsigned int size) |
| Create a LinkedList from an array of pointers. More... | |
| byte | isLLEmpty (LinkedList list) |
| Check if LinkedList is empty. More... | |
Functions for working with LinkedList type.
| void appendToLL | ( | LinkedList | list, |
| ... | |||
| ) |
Insert an item at the end of a LinkedList.
| list | The LinkedList you want to append an item to |
| ... | The item you want to append to list |
list. If you don't specify any item to be appended, still no errors occur but the content of your LinkedList can be messed up | void appendToLLFromPtr | ( | LinkedList | list, |
| const void * | element | ||
| ) |
Insert an item at the end of a LinkedList.
| list | The LinkedList you want to append an item to |
| element | Pointer to the item you want to append to list |
| byte areLLEqual | ( | const LinkedList | list1, |
| const LinkedList | list2 | ||
| ) |
Compare two LinkedList.
| list1 | The first LinkedList you want to compare |
| list2 | The second LinkedList you want to compare |
| TRUE | list1 and list2 have equal type, equal length and equal contents |
| FALSE | list1 and list2 do not have equal type, equal length or equal contents |
| LinkedList chooseNewLLFromArray | ( | const spec_t | spec, |
| const void * | arr, | ||
| unsigned int | size | ||
| ) |
Create a LinkedList from an array.
| spec | The type specifier of the array passed. Refer to spec_t for supported types |
| arr | The array you want to create the LinkedList from |
| size | The number of items of list |
list in the same order | void deleteLL | ( | LinkedList | list | ) |
Delete a LinkedList.
| list | The LinkedList you want to delete |
| void getFromLL | ( | LinkedList | list, |
| unsigned int | index, | ||
| void * | dest | ||
| ) |
Get an item from a LinkedList.
| list | The LinkedList you want to get an item from |
| index | The index of the item you want to get |
| dest | The address of the variable you want to store the item in |
| unsigned int getLLLength | ( | const LinkedList | list | ) |
Get the size of a LinkedList.
| list | The LinkedList you want to evaluate |
list | void insertToLL | ( | LinkedList | list, |
| unsigned int | index, | ||
| ... | |||
| ) |
Insert an element at a specified position of a LinkedList.
| list | The LinkedList you want to insert an element into |
| index | The position you want to insert an element at |
| ... | The item you want to insert into list |
list. If you don't specify any item to be inserted, still no errors occur but the content of your LinkedList can be messed up | byte isInLL | ( | LinkedList | list, |
| ... | |||
| ) |
Detect if an element is inside a LinkedList.
| list | The LinkedList you want search in |
| ... | The element you want to search |
| TRUE | Given element is contained in list |
| FALSE | Given element is not contained in list |
| byte isLLEmpty | ( | LinkedList | list | ) |
Check if LinkedList is empty.
| list | The LinkedList to be checked |
| TRUE | list is empty |
| FALSE | list is not empty |
| int linearSearchLL | ( | LinkedList | list, |
| ... | |||
| ) |
Linear search for LinkedList.
| list | The LinkedList to be inspected |
| ... | The key to be searched |
| KEY_NOT_FOUND | The key was not found |
| void * linearSearchLLPtr | ( | LinkedList | list, |
| ... | |||
| ) |
Linear search for LinkedList.
| list | The LinkedList to be inspected |
| ... | The key to be searched |
| NULL | The key was not found |
| void mergeLL | ( | LinkedList | list1, |
| const LinkedList | list2 | ||
| ) |
Merge two LinkedList.
| list1 | The first LinkedList to be merged, where the merged LinkedList is saved |
| list2 | The second LinkedList to be merged |
| LinkedList newLL | ( | const spec_t | spec | ) |
Allocate a new LinkedList of specified type.
| spec | Type specifier of the LinkedList you want to create. Refer to spec_t for supported types |
| LinkedList newLLFromCharArray | ( | const char | arr[], |
| unsigned int | size | ||
| ) |
Create a LinkedList from a array of chars.
Equivalent to chooseNewLLFromArray("%c", arr, size). Refer to chooseNewLLFromArray()
| LinkedList newLLFromDoubleArray | ( | const double | arr[], |
| unsigned int | size | ||
| ) |
Create a LinkedList from an array of doubles.
Equivalent to chooseNewLLFromArray("%lf", arr, size). Refer to chooseNewLLFromArray()
| LinkedList newLLFromFloatArray | ( | const float | arr[], |
| unsigned int | size | ||
| ) |
Create a LinkedList from a array of floats.
Equivalent to chooseNewLLFromArray("%f", arr, size). Refer to chooseNewLLFromArray()
| LinkedList newLLFromIntArray | ( | const int | arr[], |
| unsigned int | size | ||
| ) |
Create a LinkedList from a array of ints.
Equivalent to chooseNewLLFromArray("%i", arr, size). Refer to chooseNewLLFromArray()
| LinkedList newLLFromLL | ( | const LinkedList | list | ) |
| LinkedList newLLFromPtrArray | ( | const void * | arr, |
| unsigned int | size | ||
| ) |
Create a LinkedList from an array of pointers.
Equivalent to chooseNewLLFromArray("%p", arr, size). Refer to chooseNewLLFromArray()
| void printLL | ( | const spec_t | spec, |
| const LinkedList | list | ||
| ) |
Print contents from a LinkedList.
| spec | The type and format specifier you want to use to print the single element of the LinkedList. Use the printf() conventions |
| list | The LinkedList you want to print |
| void removeFromLL | ( | LinkedList | list, |
| unsigned int | index | ||
| ) |
Remove an item from a LinkedList.
| list | The LinkedList you want to delete an item from |
| index | The index of the item you want to delete |
| void setLLItem | ( | LinkedList | list, |
| unsigned int | index, | ||
| ... | |||
| ) |
Set value of an element of a LinkedList.
| list | The LinkedList you want to edit |
| index | The index of the element you want to change |
| ... | The item you want to set the index-th element of list to |
| void sliceLL | ( | LinkedList | list, |
| unsigned int | begin, | ||
| unsigned int | end | ||
| ) |
Slice a LinkedList.
| list | The LinkedList you want to slice, where the sliced LinkedList is saved |
| begin | The index of the beginning of the slice |
| end | The index of the end of the slice |