C port of SD, a very efficient flash cards app
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
Anthony Wang 9009a690b9
Finish porting SD code
11 months ago
.gitignore Initial commit 12 months ago
LICENSE Initial commit 12 months ago
README.md Finish porting SD code 11 months ago
cd.c Finish porting SD code 11 months ago
segmenttree.c Finish porting SD code 11 months ago
segmenttree.h Finish porting SD code 11 months ago

README.md

CD

C port of SD, a very efficient flash cards app

Usage

Flash cards are stored in the cards table of a SQLite database. There are four columns: idx INTEGER PRIMARY KEY, weight INTEGER, key STRING, val STRING. The idx is a unique index for each card, starting at 0. The weight is how often the card should come up. The key and value are the front and reverse sides of the card. You can use the sqlite3 CLI to create a card deck.

Now build this project with gcc cd.c segmenttree.c -o cd -lsqlite3 -O2 -march=native and run ./cd to enjoy a fast flash cards experience! The program will display the key of a randomly selected card. Press any key to show the val of the card. Now press either y or n depending on whether you got the card correct, and the program adjusts that card's weight.

If you're wondering where the name came from, this is the C port of SD.

Performance

CD is designed to be extremely efficient in order to support a very large number of flash cards and should be able to handle millions of cards with ease. If N is the number of cards, initializing the program requires O(N) time and O(N) memory. Selecting a random card and adjusting its weight requires O(log N) time. Internally CD uses segment trees to achieve this time complexity.