Cheat sheets

DS-02Cheat sheet1 pageIn a paid pack

Array Address Calculation

Address formulas for one-, two- and three-dimensional arrays in row-major and column-major order with arbitrary lower bounds, the general n-dimensional rule, element counts, reverse problems that recover the base address or a dimension from two known addresses, and a compiled C program showing that C stores arrays row by row. All worked values are computed by a verification script.

Diagrams from DS-02

DS-03Cheat sheet1 pageIn a paid pack

Special Matrices and Sparse Storage

Packed storage for lower and upper triangular, symmetric, diagonal and tridiagonal matrices with the offset formulas for row-major and column-major packing, sparse matrices in triplet and compressed sparse row form with their space break-even points, and the shift cost of inserting into and deleting from an array. Every formula was checked against a brute-force enumeration for n up to 12.