# Examples of NESL code

## Trivial examples (< 5 lines):

## Small examples (< 50 lines):

- Line Fitting:
Implements line-fitting using a least-square fit.
- Median Finding:
Finds the kth smallest element of a sequence using the quickmedian
algorithm (similar to quicksort, but only recurses on one of the two
subsets).
- Primes:
Finds all the primes less than a specified number. Uses a parallel
primes sieve and does O(n lg lg n) total work.
- String Searching:
Finds a pattern in a search string.
- Sorting routines:
Examples of quicksort, bitonic sort and Batcher's Odd-Even Mergesort.

## Medium sized examples (< 200 lines):

- Adaptive Integration:
Numerically integrates functions of a single variable
over any specified range. Adaptively determines interval sizes
over subranges.
- Connected Components (Awerbuch-Shiloach):
The Awerbuch-Shiloach algorithm for finding the connected components
of a graph.
- Convex Hull:
Finds the convex-hull of a set of points in two dimensions using the QuickHull algorithm.
- Hash Table:
Implements insersion and searches in a table using parallel
hashing with quadratic probing.
- A Micro Shell:
Implements a trivial shell that keeps track of the current
working directory and executes shell commands by invoking csh.
- The NAS Conjugate Gradient Benchmark:
A Nesl version of the Conjugate Gradient (CG) benchmark from the the
NAS suite of benchmarks.
- Geometric Graph Separator:
Uses a K-d tree to recursively separate a graph into parts such that
the number of edges cut by the partitions is minimized. It works on
graphs embeded in any k-dimensional space.

## Larger examples: