Age | Commit message (Collapse) | Author |
|
Working on it right now, just a copyright and documentation so far.
|
|
|
|
|
|
Need to remember to format before each commit
|
|
|
|
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.
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
Basically accumulates values, check
https://en.wikipedia.org/wiki/Fold_(higher-order_function) for more
detail.
|
|
|
|
void return, just maps f onto every value in the linked list till
nullity.
|
|
C++ styling.
|
|
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.
|
|
|
|
Just write a few lines and it saves so much time. Don't try to
automate it too much though.
|
|
Nice feature of C++, destructors make it kinda nice to do memory
management. Though they don't fully reduce the pain lol
|
|
Main now uses append and cout mechanisms for a simple program!
|
|
cout has inbuilt support for multiple types, easier than using
printf. Just have to ease the compiler into it
|
|
Slight whiplash from change to C++, can just use typename now.
|
|
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.
|
|
|