Very efficient flash cards app using Go and SQLite
This repository has been archived on 2024-01-02. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
2022-04-21 12:22:42 -05:00
examples Add example wordlist 2022-04-21 12:22:42 -05:00
go.mod Build segtree from sqlite file 2022-03-28 10:20:00 -05:00
go.sum Build segtree from sqlite file 2022-03-28 10:20:00 -05:00
LICENSE Initial commit 2022-03-27 17:18:36 -05:00
README.md Add link to CD in the README 2022-04-18 20:06:49 -05:00
sd.go Weigh incorrect answers more heavily 2022-03-30 22:27:55 -05:00
segmenttree.go Use pointers for struct functions to avoid copies 2022-03-31 14:04:51 -05:00

SD

Very efficient flash cards app using Go and SQLite

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 go build and run ./sd 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, I named this app after a common type of flash card. 😀

Performance

SD 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 SD uses segment trees to achieve this time complexity.

A C port for maximal speed and minimal executable size can be found here.