Chapter 2: Abstract Data Structures.
- Fibonacci.cpp: Compute the first elements of Fibonacci series with or without pointer arithmetic.
- indexremapping.cpp: Conversions between 1D and 2D array indices of arrays.
- multidim-indexremapping.cpp: Conversions between 1D and dD array indices of arrays.
- linkedlist.cpp: Simple templated linked list class.
- areafloodfill.cpp: Area flood-filling using a queue.
Input image fillex.ppm (Result is written in floodfill-result.ppm)
This short program shows how to overload the less than comparison operator to get a generic dictionary.
Two segments defining the diagonals of a square are created. We associate to them two line equations.
Depending on the position of the sweep line, we show that seg1 is below or above seg2.
Detect whether a set of line segments intersect or not.
Implement in a STL fashion a simple but optimal algorithm
to detect whether there exists an intersection point among a set of n segments in O(n log n) time.
Snapshot 1 PNG,
Snapshot 2 PNG and
Snapshot 3 PNG.
- srg.cpp: Statistical region growing segmentation using the union-find data structure of Tarjan.
Call srg.exe srg-source.ppm.
Input image srg-source.ppm (Result is written in srg-output.ppm)
- priorityqueue-stl.cpp: Priority queue in C++ STL (sample program)
- hashing-stl.cpp: 1D Hashing in C++ STL (sample program)
- traits-numerics.cpp: Traits class concept using the numerics class in C++
- traits-geometrykernel.cpp: Geometric traits class are useful for encapsulating the geometric kernel and the predicates of algorithms.
The code computes the convex hull of a point set using Andrew's algorithm (traits adapted from the class notes of Lutz Kettner). (This code is not robust. See chapter Robustness for more.)
Require OpenGL, see snapshot (PNG).
Last updated, May 2005.