Commit Graph

25 Commits

Author SHA1 Message Date
Aryadev Chavali
dc090ace5f (*)~changed up makefile recipes, cleaned up README 2023-06-25 07:38:39 +01:00
Aryadev Chavali
6d504da381 (*)~reworking this project 2023-06-25 07:33:06 +01:00
Aryadev Chavali
b58ee52a81 (General)~forgot to format my files
Need to remember to format before each commit
2021-11-26 02:35:23 +00:00
Aryadev Chavali
516325444f (btree)+basic main test for insert 2021-11-23 06:20:39 +00:00
Aryadev Chavali
55a24fc560 (btree)+recursive insert algorithm
Just checks the value of the current node against value, assesses if
the leaf it needs to store it in is a NULL or not, then either
allocates to that leaf or recursively calls insert on that leaf (so it
may sort the value).  Uses pointer magic for some cleaner code.
2021-11-23 06:19:13 +00:00
Aryadev Chavali
8de4860e1d (btree)+struct for binary tree
Has a custom enum for ordering, as each type of data may have its own
comparator system.  Hence, each node will have a comparison function
pointer internally.  Though this increases the data required to create
a binary tree, it does make it easier to support multiple types.
2021-11-23 06:14:06 +00:00
Aryadev Chavali
855e38cde4 (General)~extract valgrind memcheck flags to VFLAGS variable 2021-11-23 06:14:06 +00:00
Aryadev Chavali
2808890b2d (General)+ggdb flag to CFLAGS makefile 2021-11-23 06:09:05 +00:00
Aryadev Chavali
868af38c67 (General)~memcheck recipes now has --show-leak-kinds=all 2021-11-23 06:08:44 +00:00
Aryadev Chavali
f8093dceca (btree)+binary tree cpp file with recipes in makefile 2021-11-22 06:22:42 +00:00
Aryadev Chavali
c0ccb7b384 (list)+some flavour text for list program output 2021-11-22 06:09:34 +00:00
Aryadev Chavali
ab5d1c6997 (list)+filter function
This generates a new list, and appends to it every time the current
list value satisfies the condition.  It then recursively calls the
filter on the next value.
2021-11-22 06:08:52 +00:00
Aryadev Chavali
1d91eb52b6 (list)+reduce function
Basically accumulates values, check
https://en.wikipedia.org/wiki/Fold_(higher-order_function) for more
detail.
2021-11-22 06:00:05 +00:00
Aryadev Chavali
8f0ee1694b (list)+example for map in main 2021-11-22 05:59:48 +00:00
Aryadev Chavali
f4b08ddada (list)+map function
void return, just maps f onto every value in the linked list till
nullity.
2021-11-22 05:53:07 +00:00
Aryadev Chavali
1537bb705b (list)~NULL -> nullptr
C++ styling.
2021-11-22 05:52:49 +00:00
Aryadev Chavali
36d5eb111a (list)+recursive reverse algorithm for singly linked lists
Pretty simple, returns the last node as that's the new root node.
Uses default parameters to make sure the first node has next set to null.
2021-11-21 00:28:23 +00:00
Aryadev Chavali
2f0fe5aef2 (list)+general style change, use unary switches for checking null 2021-11-21 00:28:01 +00:00
Aryadev Chavali
ede2e8bfc0 (General)+makefile for common recipes that I'll use in this project
Just write a few lines and it saves so much time.  Don't try to
automate it too much though.
2021-11-20 22:58:43 +00:00
Aryadev Chavali
e30444cdde (list)+destructor function in struct
Nice feature of C++, destructors make it kinda nice to do memory
management. Though they don't fully reduce the pain lol
2021-11-20 22:57:27 +00:00
Aryadev Chavali
cae91a793c (list)+first test with appends and output
Main now uses append and cout mechanisms for a simple program!
2021-11-20 22:51:25 +00:00
Aryadev Chavali
fc6fc4032b (list)+simple output mechanism via C++ streams
cout has inbuilt support for multiple types, easier than using
printf.  Just have to ease the compiler into it
2021-11-20 22:50:05 +00:00
Aryadev Chavali
fccfcd4a9f (list)~struct List is not necessary
Slight whiplash from change to C++, can just use typename now.
2021-11-20 22:40:56 +00:00
Aryadev Chavali
a495bd9c64 (list)+list.cpp file
Will have all the singly linked list algorithms I can think of, using
the structure I have defined (template based singly linked list) and
the simple append function I have added that also acts as the main
method of creating an instance.
2021-11-20 22:35:32 +00:00
Aryadev Chavali
73e2e18839 (General)+readme 2021-11-20 22:35:18 +00:00