Commit Graph

48 Commits

Author SHA1 Message Date
Aryadev Chavali
c1355e3003 Clang format in C and C++ mode 2024-09-15 14:51:26 +01:00
Aryadev Chavali
e56169441b Triangle numbers implementation 2024-09-15 14:51:06 +01:00
Aryadev Chavali
97b23e4f71 Add vec to Makefile and change cflags, remove vflags 2024-08-11 22:45:03 +01:00
Aryadev Chavali
023d3d0dc9 Add a TBC solution to leetcode 2024-08-11 22:44:49 +01:00
Aryadev Chavali
b6e93a033a Implementing a vector using memory tricks, TBC 2024-08-11 22:44:33 +01:00
Aryadev Chavali
afdddae5dc Fix up leetcode 2024-07-19 15:25:12 +01:00
Aryadev Chavali
97f5fcd7d0 Fix productexceptself 2024-07-17 20:15:21 +01:00
Aryadev Chavali
f7f106195a Move qsort.cpp 2024-07-17 20:12:07 +01:00
Aryadev Chavali
262ab3fefa Extracted comparator function into insert caller 2024-07-17 20:10:56 +01:00
Aryadev Chavali
894f79581f New file for quicksort algorithm 2024-07-17 20:10:56 +01:00
Aryadev Chavali
6d21bce57b Tons of solutions 2024-07-17 20:10:06 +01:00
Aryadev Chavali
4359caa3ca Moved implementations to folder 2024-04-29 15:43:17 +05:30
Aryadev Chavali
d30043274d (*)~fixed makefile clean recipe 2023-07-10 14:15:23 +01:00
Aryadev Chavali
d9e8ccb3b2 (bsearch)+algorithm implementation
Reads lines from "bsearch.txt", asks user for a number then binary
searches that number in the input data from "bsearch.txt".
2023-07-10 14:14:15 +01:00
Aryadev Chavali
5b05f2323c (bsearch)+Elisp script to generate random values in 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.
2023-07-10 14:12:56 +01:00
Aryadev Chavali
b8b541efbc (*)+bsearch to makefile recipes, +ignoring *.txt files 2023-07-10 14:12:31 +01:00
Aryadev Chavali
b662f16eff (powerset)+some tests for powerset 2023-07-10 01:10:08 +01:00
Aryadev Chavali
3592ea3134 (powerset)~Common Lisp -> Racket
Decided to try my hand at racket, fundamentally the algorithm is the
same and code structure is basically the same anyway.  Just looks cleaner.
2023-07-09 22:01:27 +01:00
Aryadev Chavali
13621ae44d (*)+MIT License
Should start licensing stuff just to avoid a headache later!
2023-07-09 22:01:07 +01:00
Aryadev Chavali
e7e819e1dd (list)+constructor for List, ~cleaned up some code
Same argument as btree
2023-07-09 16:27:37 +01:00
Aryadev Chavali
5c928bc8c7 (Makefile)~modified to be slightly more agnostic
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.
2023-07-09 16:22:46 +01:00
Aryadev Chavali
509c8930e8 (btree)+constructor for structure, cleaned up some code
Might as well use C++ features if I've got them
2023-07-09 16:22:23 +01:00
Aryadev Chavali
7df5a3c947 (powerset)+lisp program for finding power sets
Working on it right now, just a copyright and documentation so far.
2023-06-25 07:42:40 +01:00
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