JavaScript Binary Search Tree: Search values in an array using binary search

Recommend this page to a friend!
     
  Info   Example   View files Files   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 82 All time: 455 This week: 3Up
Version License JavaScript version Categories
simple-binary-tree 1.0Custom (specified...5Data types, Utilities and Tools, Algo...
Description 

Author

This object can search values in an array using binary search.

It can initialize a sorted array using binary search to insert each of the array elements.

The object can also insert new values in the array and search the array to determine if a given value is already present.

Innovation Award
JavaScript Programming Innovation award nominee
August 2016
Number 4
Binary search is an efficient algorithm that is used to search for the position of a element that may be present in a sorted array or not.

It is used to minimized the number of checks necessary to determine if has array a given value and its position if present.

This object uses the binary search algorithm to search for values or insert new values in an array so its values always remain sorted.

Manuel Lemos
Picture of gustavo oliveira de avila
  Performance   Level  
Name: gustavo oliveira de ... <contact>
Classes: 2 packages by
Country: Brazil Brazil
Innovation award
Innovation award
Nominee: 2x

Winner: 1x

Example

<html> <head> <script src="SBT.js"></script> </head> <body> <script> var text=new binary_tree(["bar","axe","cocoa","avocado","executable","file"]); text.insert("header"); console.log("axe index="+text.search("axe")); console.log("text tree array="+JSON.stringify(text.tree)); var number=new binary_tree([2,1,5,6,3,4]); number.insert(2001); console.log("5 index="+number.search(5)); console.log("number tree array="+JSON.stringify(number.tree)); </script> </body> </html>

  Files folder image Files (3)  
File Role Description
Accessible without login Plain text file index.html Example example of usage
Accessible without login Plain text file license.txt Lic. MIT-zero license
Plain text file SBT.js Class the class itself

 Version Control Unique User Downloads Download Rankings  
 0%
Total:82
This week:0
All time:455
This week:3Up