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.
Overview
Comments
-
Extended hash_table_iter_next function
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 license title
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)
-
Refactored HashTableEntry to hold its Key and Value in a struct pointer object KeyValuePair.
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.
-
Cannot modify data of list entry. Was this meant to be this way?
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.
-
Added algorithms for DFS,BFS,BST,CheckingForBST,Tree
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 -
Add validation check of input parameters
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.
-
regarding the missing rb_tree_subtree_height function in the rb_tree.c file
As addressed earlier also, the implementation of
rb_tree_subtree_height
function is missing in the filerb_tree.c
which is specified there in the header file. I have implemented and coded that function, so can you allow me to make a pull request for the same, so that you cam look at it, in order to resolve the issue? -
missing rb_tree_subtree_height implemention
Hi there, During wrapping this into a python libraty, I found
rb_tree_subtree_height
missing inrb-tree.c
, which appears in the header file. Did I miss something? -
[bug] rb-tree: Calling the comparator on node values instead of keys
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!
-
Cannot distinguish between no-op insert and memory error
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.
Releases(c-algorithms-1.2.0)
-
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.
Test suite:
- 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.
Bugs fixed:
- Memory leak in hash table.
- Bugs with the AVL tree.
- Trie responds to out of memory scenarios correctly.
Source code(zip)
c-algorithms-1.2.0.tar.gz(448.15 KB)
-
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.
Source code(zip)
c-algorithms-1.1.0.tar.gz(412.03 KB)
- Added data structures:
-
c-algorithms-1.0.0(Apr 26, 2015)
Several algorithms and data structures implemented in C++ by me (credited to others where necessary).
Algorithms This repository contains my implementations of several algorithms and data structures in C++ (credited to others where necessary). It has i
Fundamentals of Data structures and algorithms in c++
Data Structures & Algorithms About the repository: Contains theories and programming questions related to fundamentals of data structures and algorith
Algorithms & Data structures in C++.
Algorithms & Data Structures in C++ 目标 ( goal ) : 经典的算法实现 (classical algorithms implementations) 服务器端 (based on linux/gcc) 正确,易于使用和改造, 一个头文件一个算法,并附带一个
C++17 (-O2) template for competitive programming algorithms, which contains numerous math algorithms.
cpplibForCP C++17 (-O2) template for competitive programming algorithms, which contains numerous math algorithms. Aims: build a stable, fast, easy-to-
CXXGraph is a Header-Only C++ Library for Graph Representation and Algorithms
CXXGraph is a small library, header only, that manages the Graph and it's algorithms in C++. In other words a "Comprehensive C++ Graph Library".
Header-only C++ library for robotics, control, and path planning algorithms.
Header-only C++ library for robotics, control, and path planning algorithms.
c++ library including few algorithms and datastructures
c++ library including few algorithms and datastructures
Library for building multi-level indoor routes using routing algorithms.
Library for building multi-level indoor routes using routing algorithms. You can easily construct routing graphs and find the shortest path for optimal indoor navigation.
This library contains a set of algorithms for working with the routing graph.
Library for building multi-level indoor routes using routing algorithms. You can easily construct routing graphs and find the shortest path for optimal indoor navigation.
IntX is a C++11 port of IntX arbitrary precision Integer library with speed, about O(N * log N) multiplication/division algorithms implementation.
IntX IntX is a C++11 port of IntX arbitrary precision Integer library with speed, about O(N * log N) multiplication/division algorithms implementation
C++ implementations of well-known (and some rare) algorithms, while following good software development practices
ProAlgos: C++ This project is focused on implementing algorithms and data structures in C++, while following good software engineering practices, such
Provide building blocks (software, hardware and algorithms) for implementing SLAM using small sensors
RemoteSLAM The purpose of this repo is to provide the building blocks (software drivers, hardware and algorithms) for implementing SLAM systems using
Every week exercises for Introduction to Algorithms and Programming
cen109-algorithms commands to compile and link C and C++ programs gcc filename.c -o executableFileName g++ filename.cpp -o executableFileName filename
c language's datastruct and algorithms.
cdsaa 介绍 学习数据结构与算法的C语言实现 主要数据结构 动态字符串 动态数组 单向链表 栈 主要算法 更新中. . . 目录结构 |-- include |---- CArray.h 动态数组 |---- CList.h 单向链表 |---- CStack.h 栈 |---- CString
Snowball compiler and stemming algorithms
Snowball is a small string processing language for creating stemming algorithms for use in Information Retrieval, plus a collection of stemming algorithms implemented using it.
Collection of various algorithms in mathematics, machine learning, computer science, physics, etc implemented in C for educational purposes.
The Algorithms - C # {#mainpage} Overview The repository is a collection of open-source implementation of a variety of algorithms implemented in C and
This repository contains path planning algorithms in C++ for a grid based search.
This repository contains path planning algorithms in C++ for a grid based search.
In this project, we implemented twelve different sorting algorithms.
C - Sorting algorithms & Big O In this project, we implemented twelve different sorting algorithms. Tests tests: Folder of test files. Provided by Alx
All basic algorithms for solving problems of CP
All basic algorithms for solving problems of CP