Warmwaffles/Strassen - GitHub. The Stony Brook Algorithm Repository. This WWW page is intended to serve as a comprehensive collection of algorithm implementations for over seventy of the most fundamental problems in combinatorial algorithms. The problem taxonomy, implementations, and supporting material are all drawn from my book The Algorithm Design Manual. Since the practical person is more often looking for a program than an algorithm, we provide pointers to solid implementations of useful algorithms, when they are available.
Because of the volatility of the WWW, we provide local copies for many of the implementations. We encourage you to get them from the original sites instead of Stony Brook, because the version on the original site is more likely to be maintained. Further, there are often supporting files and documentation which we did not copy, and which may be of interest to you. The local copies of large implementations are maintained as gzip tar archives and, where available, DOS zip archives. Use at your own risk. On C Linked Lists - Rusty Russell's Coding Blog. There are two basic styles of double-linked lists in C; I’ll call them ring style and linear style. The Linux kernel has ring-style, defined in include/linux/list.h. You declare a ‘struct list_head’ and everyone who wants to be in the list puts a ‘struct list_head list’ in their structure (struct list_node in CCAN’s version).
This forms a ring of pointers in both the forward and reverse directions. SAMBA uses linear-style, defined in lib/util/dlinklist.h. You simply declare a ‘struct foo *’ as your list, and everyone who wants to be in the list puts a ‘struct foo *prev, *next’ in their structure. This forms a NULL-terminated list in the forward direction (the reverse direction became a ring recently to facilitate tail access). Points in favor of ring-style lists: Insertion and deletion are branchless, as the elements and head are homogeneous: head->next->prev = new; new->next = head->next; new->prev = head; head->next = new;vs:if (! Points in favor of linear-style lists: No tags. Sorting Algorithm Animations.
Algorithms in Java, Parts 1-4, 3rd edition by Robert Sedgewick. Addison Wesley, 2003. Quicksort is Optimal by Robert Sedgewick and Jon Bentley, Knuthfest, Stanford University, January, 2002. Dual Pivot Quicksort: Code by Discussion. Bubble-sort with Hungarian (“Csángó”) folk dance YouTube video, created at Sapientia University, Tirgu Mures (Marosvásárhely), Romania. Select-sort with Gypsy folk dance YouTube video, created at Sapientia University, Tirgu Mures (Marosvásárhely), Romania. Sorting Out Sorting, Ronald M. Ioannis cherouvim » Blog Archive » A table that should exist in all projects with a database.
It’s called schema_version (or migrations, or whatever suits you) and its purpose is to keep track of structural or data changes to the database. A possible structure (example in MySQL) is: create table schema_version ( `when` timestamp not null default CURRENT_TIMESTAMP, `key` varchar(256) not null, `extra` varchar(256), primary key (`key`) ) ENGINE=InnoDB; insert into schema_version(`key`, `extra`) values ('001', 'schema version'); Whether you add this table from the beggining of the project or just after you’ve deployed the first version to a staging or production server is up to you. Whenever you need to execute an SQL script to change the database structure or perform a data migration you should be adding a row in that table as well.
And do that via an insert statement at the begining or end of that script (which is committed to the project’s code repository). E.g: insert into schema_version(`key`, `extra`) values ('002', 'FOO-22 user profile enhancement'); another example: I has 1337 code. Eternally Confuzzled - Skip Lists. By Julienne WalkerLicense: Public Domain A binary search tree is a data structure designed for efficient search, insertion, and deletion in the presence of a large number of items. While these operations are easy to implement for a basic binary search tree, less trivial operations such as flexible non-recursive traversal are not as simple to create.
Also, basic binary search trees have uncomfortably common worst case behavior that makes them impractical for many applications. The initial solution to the problem of degenerate trees is to maintain a balancing invariant, whereby the tree is restructured to enforce a certain measure of balance when a new insertion or deletion causes the invariant to be broken.
Worse yet, balanced trees are very inflexible when it comes to optimization. An alternative to balanced trees is to use randomization to guarantee, with high probability, that a tree will not be so unbalanced as to lose its O(log N) performance properties. Random height Searching.