57 Commits

Author SHA1 Message Date
Aryadev Chavali
c02a943a29 qsort: stack based implementation 2025-10-27 23:28:19 +00:00
Aryadev Chavali
79249027cb qsort: add another way to read numbers and test 2025-10-27 23:09:56 +00:00
Aryadev Chavali
946006096b qsort: clean up the implementation (forward walk rather than backward) 2025-10-27 23:09:16 +00:00
Aryadev Chavali
964e001dd5 qsort: generate random numbers in hand instead of reading them 2025-10-27 00:29:45 +00:00
Aryadev Chavali
03ba2096c1 bsearch-gen -> num-gen 2025-10-27 00:29:19 +00:00
Aryadev Chavali
e3863557f5 Some cleanup of qsort and vec 2025-10-27 00:28:51 +00:00
Aryadev Chavali
8ee90f0d06 Fix a bug in pingala.cpp 2025-10-27 00:20:46 +00:00
Aryadev Chavali
449d15c1c7 clean up of bsearch 2025-10-27 00:20:36 +00:00
Aryadev Chavali
8dbedb691d Way more inefficient version of pingala with better padding. 2025-03-29 22:05:59 +00:00
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