I changed the return value of n in List_length to reflect the number of items inside the list, so a newly initialized list will return a length of 0. To prevent items in List_toArray from being cut off, I addeone back to n at the beginning of the List_toArray function.
* Create dynamic_stack.c
In this implementation, functions such as PUSH, POP, PEEK, show_capacity, isempty, and stack_size are coded to implement dynamic stack.
* Update dynamic_stack.c
Worked on Suggested Changes.
* Update dynamic_stack.c
Worked on suggested changes.
* Update dynamic_stack.c
* Update: Used Int type that are OS-independent
---------
Co-authored-by: David Leal <halfpacho@gmail.com>
* Fix : memory allocation method
"new" is not used in C , because of that the compiler was giving compilation error.
Instead malloc was used for memory allocation.
* updating DIRECTORY.md
* Update data_structures/graphs/kruskal.c
Co-authored-by: Stepfen Shawn <m18824909883@163.com>
* updating DIRECTORY.md
---------
Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
Co-authored-by: Stepfen Shawn <m18824909883@163.com>
* Update singly_link_list_deletion.c
Delete function is updated to delete at any required position (not only first)
* Update singly_link_list_deletion.c
The code is changed as per the suggestions. Please lat me know if there are any changes to be done
Thank you
* Update singly_link_list_deletion.c
The code is changed as per the suggestions. Please let me know if there are any changes to be done
Thank you..
* Update singly_link_list_deletion.c
I added inserting at any input location . Please let me know if changes need to be done
* Update singly_link_list_deletion.c
* Update singly_link_list_deletion.c
I updated self tests for both insert and delete functions properly. Please let me know if any changes need to be done
Thank you
* Update singly_link_list_deletion.c
As per your suggestions I updated the code. Please let me know if any changes need to be done..
* chore: apply suggestions from code review
Co-authored-by: David Leal <halfpacho@gmail.com>
The call to realloc() already frees the previously allocated memory if necessary.
By the man page of realloc(): "f the area pointed to was moved, a free(ptr) is done.",
and free(): "If free(ptr) has already been called before, undefined behavior occurs.".
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.
* Putting queue in correct dir and creating include file for it
* Update data_structures/queue/include.h
missing one function, added
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
* frequencies of words started
* A program to Print words contained in a file in alphabetical order
* Apply suggestions from code review
Co-authored-by: David Leal <halfpacho@gmail.com>
* appropriate comments added as suggested from code review
* comments cleaned up
* updating DIRECTORY.md
* Apply suggestions from code review
Co-authored-by: David Leal <halfpacho@gmail.com>
* commenting re-worded
* Add link to algorithm
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* main function moved to the bottom and function prototypes deleted
* uint64_t data type used for non negative values
* uint8_t used
* all int types fixed
* detailed explanation of algorithm added
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* tests and documentation added
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* documentation added
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Update data_structures/binary_trees/words_alphabetical.c
Co-authored-by: David Leal <halfpacho@gmail.com>
* Apply suggestions from code review
Co-authored-by: David Leal <halfpacho@gmail.com>
* documentation added
* Apply suggestions from code review
Co-authored-by: David Leal <halfpacho@gmail.com>
* Add documentation
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Doubly linked list, simple code.
#633
* organizing code a bit more
* add link in DIRECTORY.md and more comments/cleaning.
* remove global variables and redundancy.
* add Wikipedia reference
* add documentation comments in all functions/headers
* add update in file brief
Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>
* remove part of file @details
Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>
* add docs + fix error in getMax
* fix clang-tidy alerts and errors
* rearrange comments
* allow subfolders in data_structure
* set pointer to NULL after purge