C Algorithms The C programming language includes a very limited standard library in comparison to other modern programming languages. This is a collection of common Computer Science algorithms which may be used in C projects. The code is licensed under the ISC license (a simplified version of the BSD license that is functionally identical). As such, it may legitimately be reused in any project, whether Proprietary or Open Source.
A library of common data structures and algorithms written in C.
Added a flag to decide HashTableValue.
- Flag VALUE instructs hash_table_iter_next to return value.
- Flag KEY instructs hash_table_iter_next to return the key.
- Flag KEY_VALUE instructs hash_table_iter_next to return both key value pair.
KeyValue Pair is held in array where array is the key and array is the value.
It's not strictly required, but it's useful metadata, and part of the recommended license template text (see http://choosealicense.com/licenses/isc/ and https://opensource.org/licenses/isc-license)
The reason for this is to:
- Return both the Key and Value in composite
- Have function
KeyValuePairobject holding the composite of Key and Value without the extra call to lookup the value using
- Makes the interface cleaner.
There are functions to get the value of a ListEntry, but there are no functions to write to the data of a ListEntry.
The underlying struct is defined in the list.c file so it is not possible to access it directly.
I am willing to implement the feature if needed.
DFS -Depth First Search for graphs BFS - Breadth First Search for graphs BST - Binary Search Tree CheckingForBST - Check if a given Tree is a Binary Search Tree Tree - Implementation of tree.invalid
check the sanity of pointers as input parameters.
I am wondering whether it is necessary to add a callback function to free the ListValue when the entries are removed.
This line should check the keys, not the values.
Separately, does this repro accept new features such as implementing the missing deletion functionality in rbtree?
I preface that I'm quite new to C so this may be completely off. However, in:
0return value is used both for an operation that does not change the state of a set (because the value already exists), which may or may not be an issue, and a memory error, which is more likely to be an issue, and of a different type.
Shall the former not use a kind of custom error code, and the latter an ENOMEM according to https://www.gnu.org/software/libc/manual/html_node/Error-Codes.html ?
Splint is a static code analysis tool, splint works with annotations. These annotations help you to do two things, it defines how functions behaves and which assumptions on input are made. Using splint memory leaks might be detected.
The only downside is that it is a lot of work to go through all code. But maybe it is possible to implement it data structure by data structure in a separate branch untill all structures are done.
c-algorithms-1.2.0(Apr 26, 2015)
- The license has been changed to the ISC license.
- Support for compiling with gcc coverage options and running tests in valgrind.
- All headers now have extern "C" definitions for use in C++ programs.
- Trie free function uses a non-recursive algorithm to avoid the possibility of stack overflow.
- Framework added for testing memory allocation/free.
- Tests have been fixed to properly free any memory allocated during execution of the test.
- Tests have been expanded to increase the code coverage.
- A test case has been added for testing use of the program in C++ programs.
- Memory leak in hash table.
- Bugs with the AVL tree.
- Trie responds to out of memory scenarios correctly.
c-algorithms-1.1.0(Apr 26, 2015)
- Added data structures:
- Binary Heap
- Binomial Heap
- Bloom Filter
- Iterator functions changed to a model based around an iterator structure rather than callback functions.
- Void pointers used for keys/values replaced by typedefs to void pointers. This allows the type to be changed to something else if desired.
- Hash table sizes changed to use a set of recommended prime numbers that are mathematically good for use in hash tables: http://planetmath.org/encyclopedia/GoodHashTablePrimes.html
- Tests added for some code that was not covered by the test suite.
- Failed malloc() calls are now checked for.
- Bugs fixed:
- Lockup with set_remove function.
- set_to_array did not include all values.
- Added data structures: