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.
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 iImplements all meaningful operations of an array list for a sorted array list. Contains test code, documentation and source.
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[2] where array[0] is the key and array[1] is the value.
add some validation check of input parameters. add a callback function to clean up ListValue when remove entries.
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
hash_table_iter_next(..)
returnKeyValuePair
object holding the composite of Key and Value without the extra call to lookup the value usingHashTableKey
. - Makes the interface cleaner.
https://github.com/fragglet/c-algorithms/blob/17cd712ef84948ce5c3faae911bc797ebad26e09/src/rb-tree.c#L377
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?
Thanks!
I preface that I'm quite new to C so this may be completely off. However, in:
https://github.com/fragglet/c-algorithms/blob/5b0555f4aa832a9d4c8662316994faa80f52ae93/src/set.c#L256-L275
the 0
return 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 ?
Thanks.
Add CMakeLists.txt. It can help you build.
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.
Yes, I know I could examine all the headers available, but it'd be nice if each documentation page listed which header(s) you need to include to use it.
Category: C/C++ / Standard Libraries |
Watchers: 192 |
Star: 2.5k |
Fork: 634 |
Last update: Apr 11, 2021 |