TheAlgorithms-C/data_structures
Daniel Beecham 2314a19586
feat: Rewrite the trie example (#927)
The trie example had some issues;

* It did not follow the code convention in CONTRIBUTING.md
* The createTrieNode used an inefficient zeroing method (looping over
  the entries) which also does not zero out holes in the structure (e.g.
  an alternative would be to use "*node = &(TrieNode){0}", but calloc
  does all that anyway
* It used an inefficient and clumsy printArray method
* It used strlen inside the algorithm; this new method could get rid of
  any strlen/strnlen usage (inserts/searches could be sanitized by
  snprintf)
* This version can allow for a custom mapping function, e.g. if NULL is
  a valid separator (say that you want a trie for certain binary
  packages)
* The previous version actually contained out-of-bounds array indexing;
  there were no checks for out-of-bound indexing and words in the word
  list did contain out of bounds words. It's a surprise it was working
  so well.
* This version just returns 'int' to allow for error checks (instead of
  a printf inside the algorithm), and uses double pointers for return
  values (good practice)
* The usage example contained unnecessary mallocs, switched that out for
  scanf. The example is just an example after all, in real applications
  you'd have better input sanitazion.
2022-03-19 19:04:18 -06:00
..
array fix: update value at index and return `SUCCESS` (#932) (#933) 2022-01-15 01:34:55 +05:30
binary_trees feat: Added a program that prints words in alphabetical order using binary tree data structure (#841) 2021-07-30 16:17:09 +05:30
dictionary formatting source-code for b388e4a309 2020-05-29 20:23:24 +00:00
dynamic_array formatting source-code for 5bba04b671 2020-06-28 15:25:37 +00:00
graphs Update dijkstra.c (#928) 2022-01-11 23:50:32 +05:30
hash_set formatting source-code for b388e4a309 2020-05-29 20:23:24 +00:00
heap fix: Added `limits.h` in `data_structures/heap/max_heap.c` (#812) 2021-03-16 12:07:52 -06:00
linked_list Update stack_using_linked_lists.c 2020-10-31 00:13:40 +05:30
list formatting source-code for 5bba04b671 2020-06-28 15:25:37 +00:00
queue feat: Moving queue file to it's directory and creating include file for it (#874) 2021-10-15 11:28:04 -05:00
stack formatting source-code for 5bba04b671 2020-06-28 15:25:37 +00:00
trie feat: Rewrite the trie example (#927) 2022-03-19 19:04:18 -06:00
stack.c Update stack.c (#617) 2020-10-01 09:34:03 -04:00