GithubHelp home page GithubHelp logo

search's Introduction

Search Demonstration

Use this to demonstrate linear and binary search. Invoke this two ways:

You'll see seven rectangles and a target number. Click on one of the rectangles to reveal a number. The goal is to find the target number. Keep revealing numbers until the target is found.

This is intended to be an interactive, guided demonstration. Have a student come up to the front to work the controls. Use the linear search first. Challenge him or her to find the target number. Of course they will either have to click randomly or start from the left (or right).

Then you can demonstrate binary search, in which the numbers are sorted from least to greatest. Have the student try to find the target knowing they are sorted.

Some questions to ask the class:

  • What is the fewest numbers you'd have to look at?
  • What is the maximum number of guesses?
  • What is the average number of guesses?
  • Can you generalize these into functions of n?

The app will not announce when the target is found. The teacher and class will provide the fanfare.

Works well projected on a screen.

I use this on an iPad, too. Load the URLs into Safari, then create a home screen bookmark for it. When launched from its home screen icon, it will run in fullscreen mode, with no address bar or navigation buttons.

P.S. It's not possible to find the target on the first guess. It's rigged. This is to avoid this CS50 demonstration that didn't go as planned.

search's People

Contributors

profbbrown avatar

Watchers

 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.