Commit Graph

81 Commits

Author SHA1 Message Date
wuminbin
b7cff04574 better implementation for midpoint (#914) 2019-06-24 18:11:07 +08:00
weixuanhu
b6c3fa8992 Interpolation search - fix endless loop bug, divide 0 bug and update description (#793)
* fix endless loop bug, divide 0 bug and update description

fix an endless bug, for example, if collection = [10,30,40,45,50,66,77,93], item = 67.

fix divide 0 bug,  when right=left it is not OK to point = left + ((item - sorted_collection[left]) * (right - left)) // (sorted_collection[right] - sorted_collection[left])

update 'sorted' to 'ascending sorted' in description to avoid confusion

* delete swap files

* delete 'address' and add input validation
2019-05-18 10:59:12 +08:00
weixuanhu
7677c37011 update 'sorted' to 'ascending sorted' in comments (#789)
To avoid confusion all 'sorted' to 'ascending sorted' in comments
2019-05-06 17:54:31 +08:00
overclockedllama
dd9f0b3f2e fix comma spelling from coma to comma (#722) 2019-02-27 22:33:29 +08:00
Mickaël Schoentgen
2d70e9f747 Fix ResourceWarning: unclosed file (#681)
Signed-off-by: Mickaël Schoentgen <contact@tiger-222.fr>
2019-01-08 16:59:23 +08:00
Mickaël Schoentgen
6128533319 Fix use of deprecated assertEquals() in tests (#680) 2019-01-06 09:12:17 +08:00
Alex Brown
5f90dfbbe7 fixed file reading name for test_tabu_search.py 2018-10-19 17:40:52 -05:00
Alex Brown
b43864552b .txt instead of .py 2018-10-19 17:38:11 -05:00
Alex Brown
91fccecb56 snake_case all the things 2018-10-19 17:14:25 -05:00
ParthS007
0856a61859 Remove Multiple Unused Imports and Variable 2018-10-18 02:58:57 +05:30
Kelvin Salton do Prado
d2e77b05ef searches: add sentinel linear search algorithm 2018-10-02 00:08:42 -03:00
Harshil
8957cf7ea8
Removed empty lines (255-313)
Lines 255 to 313 were just empty, so removed those lines!
2018-05-21 10:01:44 +02:00
irokafetzaki
35110b6e44 Tabu Search 2018-05-20 02:27:01 +03:00
douly
18907e4a07 fix type error (except an int) in jumpmp_search line 7. 2018-04-13 09:56:40 +08:00
Ant Fitch
53681f199c
Fixed error in binary_search_by_recursion
In binary_search_by_recursion, if you search array for a value that does not exist, you will get this error:
RecursionError: maximum recursion depth exceeded in comparison

To fix this, first check to make sure that the value is between left and right points like this:
    if (right < left):
        return None

A similar construct has already been applied to binary_search, but did not exist in the recursive alternative.
2018-01-30 18:50:07 -08:00
cclauss
4e06949072 Modernize Python 2 code to get ready for Python 3 2017-11-25 10:23:50 +01:00
Harshil
7f87515836
Merge pull request #159 from Deepak345/master
implemented jump search
2017-11-03 16:07:43 +05:30
Harshil
8ae1f24465 Merge pull request #151 from DTBUday/master
Added Ternary Search Algorithm
2017-10-19 09:36:32 +05:30
Sarbajit Saha
6d192700c6 added interpolation search 2017-10-15 21:41:10 +05:30
Sarbajit Saha
d70b9268fe fixed spelling of coma to comma 2017-10-15 21:25:54 +05:30
Sachin Arora
85c1e03b63 Merge pull request #149 from KyleScharnhorst/master
Fix: typo in multiple files.
2017-10-13 21:32:42 +05:30
nandujkishor
e0211794da Changed the typographical error (#132)
Changed the typo in line 113 and 115 regarding recursive binary search algorithm, found by a user who commented in comments.
2017-10-13 20:33:40 +05:30
Deepak345
09131a70a1 implemented jump search 2017-10-12 14:40:15 +05:30
Chetan Kaushik
59fc956456 Merge pull request #153 from fickleEfrit/patch-1
Create quick_select.py
2017-10-10 23:05:55 +05:30
TaylorL19
8f71b30995 Fixed binary search to correctly recurse to left half and right half 2017-10-10 11:57:16 -05:00
fickleEfrit
cb3ff4a8f8 Create quick_select.py 2017-10-09 17:26:27 -04:00
Uday Patel
7447a9f9c7 Added Ternary Search Algorithm 2017-10-09 03:19:39 +01:00
KyleScharnhorst
014786e340 Fix: typo in multiple files. 2017-10-07 06:47:50 -07:00
ZivLi
23ac6bc1b5 Add bin-search implement by recursion 2017-07-05 16:40:18 +08:00
NotAName
7bdcd08996 Fixed typo in linear_search.py
The documentation comment said "binary search", not "linear search"
2016-08-30 21:06:49 +02:00
Sergey Tsaplin
ab2614574e Move files to separate directories 2016-08-01 15:06:53 +05:00