Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
Reads lines from "bsearch.txt", asks user for a number then binary
searches that number in the input data from "bsearch.txt".
|
|
Generates *LIST-SIZE* number of random numbers (within bounds
0, *UPPER-BOUND*) and inserts them one by one into bsearch.txt. Each
number is separated by a newline.
|
|
|
|
|
|
Decided to try my hand at racket, fundamentally the algorithm is the
same and code structure is basically the same anyway. Just looks cleaner.
|
|
Should start licensing stuff just to avoid a headache later!
|
|
Same argument as btree
|
|
I'm going to add recipes for other language implementations of certain
algorithms so as long as you have the correct background programs it
just requires a make call to run the program.
|
|
Might as well use C++ features if I've got them
|
|
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.
|
|
|