aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2022-04-18 20:06:20 -0500
committerAnthony Wang2022-04-18 20:06:20 -0500
commit97165561c9b5f231552a4d798490572102c83929 (patch)
tree80450e629cdc41874b0d1e2195e6984ac5fb4865
parentaaf53bc7782d61031d2f62f313cf6839b70e615f (diff)
Update README using stuff from SD
-rw-r--r--README.md14
1 files changed, 13 insertions, 1 deletions
diff --git a/README.md b/README.md
index b8161ed..969cd32 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,15 @@
# CD
-C port of SD, a very efficient flash cards app \ No newline at end of file
+C port of [SD](https://git.exozy.me/Ta180m/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.cpp -o cd -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](https://git.exozy.me/Ta180m/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](https://en.wikipedia.org/wiki/Segment_tree) to achieve this time complexity.