8 Commits

Author SHA1 Message Date
298ab3366c merge: Add proper tests for binary search (#987)
* feat: added alternative binary search

* fix: exchange "dir" for "high"

* fix : fixing code style

* fix: fixed readability

* fix: fixed code smells

* fix: remove binary search alternative

* feat: added tests of binary search interative and recursive

* fix: fixed wrong identation

* fix: refactoring duplicated code of tests
2022-04-21 11:37:20 +05:30
df4a783b06 Complying with JavaScript Standard Style (npx standard --fix). 2021-10-11 15:49:24 +02:00
74f296578a Search/Sorts algoruthms : remove live code & console.log, leave examples as comments. 2021-10-11 12:29:03 +02:00
fdeda72805 Code Refacoring 2020-10-01 21:32:44 +05:30
b4648f7b93 Code Refacoring 2020-10-01 21:30:54 +05:30
c6a36987c8 Added BinarySearchIterative Function
* BinarySearchIterative Function is added
* BinarySearch function is renamed to BinarySearchRecurisve
* changes in test function
  - 3 binarySearchRecursive tests
  - 3 binarySearchIterative tests
2020-10-01 21:24:12 +05:30
ef5566f6a6 Update BinarySearch.js (#209)
* Update BinarySearch.js

The old algorithm didn't work, I believe for two main reasons:
1 -  Number.MAX_VALUE is not a valid array index as it is used to represent the highest possible value in javascript (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_VALUE);

2 - splice() is not a pure function, every time it is called it has the side effect of modifying the original array (https://www.w3schools.com/jsref/jsref_splice.asp) ;

So I rewrote the algorithm, it now returns an index ( -1 if not found ) and it works both on numbers and on strings.

* Update BinarySearch.js

Style change

* Update BinarySearch.js

Style change

* Update BinarySearch.js
2020-06-28 12:29:19 +05:30
7ff6b8716f editing file names 2020-05-06 21:07:49 +05:30