Giter Club home page Giter Club logo

linbin's Introduction

Exploring Linear vs Binary Search
=================================

First, read this:

	http://schani.wordpress.com/2010/04/30/linear-vs-binary-search/

To run the benchmarks, do

	make
	./bench.py >out

This will take a few hours and should run on an unloaded machine.  The
results will be in the file "out".

You can then visualize the results with

	./genplot.py <out

Note that by default the X-axis is logarithmic and the number shown is
the binary logarithm of what the actual array size is.

Usually you don't want the results for all the algorithms in one plot,
so you can select which ones you like via regular expressions:

	./genplot.py 'binary.*' <out

This will only plot the results for the binary searches.

genplot.py knows lots of options and understands "--help".

To do just a single benchmarking run on one algorithm, use
"searchtest".  It has two modes: test and benchmark.

In test mode, a search algorithm is tested for correctness:

	./searchtest test <ALGORITHM> <MAX-N>

This will test the given algorithm on array sizes up to MAX-N.

To time an algorithm, use

	time ./searchtest <NUM-SEARCHES> <ALGORITHM> <N>

This will run the given number of random searches with the given
algorithm on an array of size N.

To get a list of all the algorithms, do

       ./searchtest --list

linbin's People

Contributors

schani avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.