62 Commits

Author SHA1 Message Date
Serg Gini
9ff7468e9e D solutions (#305)
* Added 1 and 2 chapters

for D lang

* [D] Added recursion code

All examples were ported from the Python code directly to D.
Naming convention of Dlang is not allowing to run code files, which started with numbers. To run examples rename the files

* [D] quicksort code

* [D] Added hashtable example

Based on the Python code

* Create 01_breadth_first_search.d

Added D example for breadth-first search

* Create 01_filesystem_dfs.d

Filesystem example in D

* Create 01_dijkstras_algorithm.d

Added Dijkstras algorithm implementation for D

* Create 01_set_covering.d

Added greedy algorythm for D

* Create 01_longest_common_sub.d

Added dynamic programming example for D language.
The code is based on Rust example

* Added modules definition

Required to run code with names starting with numbers

* Fixed proper unsigned handling
2025-05-01 18:24:42 -05:00
Mahmoud Hamdy
c06ad954f0 Update 01_binary_search.cpp (#271)
use template to the item that we are search for
2024-12-07 07:45:03 -06:00
Armin
c8ff601c52 feat: enhance recursive binary search to correctly return found index (#298)
Co-authored-by: armin <armin.eyvazi@snappshop.ir>
2024-12-07 07:39:40 -06:00
Paolo Grisoli
8a13efde83 Update examples for Zig (#287)
* update zig in chapters 1-6

* fix zig dijkstras algo

* fix zig greedy algo

* fix longest_common_subsequence in zig

* cleanup

* test: use testing allocator
2024-12-07 07:29:48 -06:00
Gabriel Santos
3e99cccfc0 Added Dart examples for chapter 3 to chapter 9 (#265)
* fix: corrected method return value following Dart's newest linter version

* feat: added Dart recursion examples for chapter 3

* feat: added quicksort example in Dart for chapter 4

* feat: added examples in Dart for the chapter 5

* feat: added Dart example for chapter 6 bfs

* feat: added djikstra example in Dart for chapter 7

* feat: added example of set covering in Dart for chapter 8

* feat: added examples for dynamic programming in dart for chapter 9
2023-08-08 18:10:15 -05:00
Aslan Autlev
022d97a56d Add examples on scheme. Chapters: 1, 2 (#258)
* add  01_binary_search.scm in 01_introduction_to_algorithms

* any fix

* add 01_selection_sort.scm to 02_selection_sort

* any fix
2023-07-19 10:56:40 -05:00
Robson Cruz
7620449322 Added R version of the binary_search function (#253) 2023-07-19 10:53:24 -05:00
Paolo Grisoli
5d9ae511d5 Add examples for Zig language (#242)
* add zig examples

* improved zig binary search

This commit improves the binary search code in zig. The function has
been made generic and the logic has been cleaned up a bit.
The code has been updated to work with zig versions >= 0.9

* simplify zig selection sort

This commit simplifies the logic of the zig selection sort. It now swaps
in place the elements of the array instead of creating another array.
This avoids allocating heap memory.
The code has also been upgraded to zig version 0.9.1

* make zig recursion examples generic

This commit modifies the zig examples for the recursion chapter to be
generic. It also updates the code to zig version 0.9.1

* update chapter 4 examples

This commit updates the zig examples in chapter 4. In particular
examples have been made generic where possible. The code has been
updated to zig version 0.9.1

* update zig hash table examples

This commit updates the examples for the chapter 5 about hash tables.
Some improvements have been done (using a set instead of a map). The
code has been updated to zig version 0.9.1

* update breadth first search zig example

This commit updates the zig example for the breadth first search
algorithm. It adds a unit test and updates the code to zig version 0.9.1

* revamp zig dijkstra example

* add comments in dijkstra zig

* fix zig greedy algorithm

* add test for zig dijkstra

* add test for zig greedy algorithm

* improve zig chapter 9 exercise

This commit improves the zig exercise to comput the longest common
subsequence.
A main function has been added and the allocator code has been extracted
from the `subsequence` function.
2022-11-18 16:36:32 -06:00
N3-M3-S1S
b3a143a3ae add dart examples for chapter 1 and 2 (#209)
* add dart example for chapter 1

* add dart example for chapter 2
2022-11-18 15:31:23 -06:00
Alexandr Shulaev
5f416d1129 Issues-126 - Fixed formatting, jsdoc and example for JavaScript/ES6 (#127)
* Issues-126 - Fixed formatting, jsdoc and non-working example for JavaScript/ES6

* Issues-126 - Fixed jsdoc
2022-11-18 14:46:18 -06:00
TheDonrad
7d27d15c0d Create Module.bsl (#182) 2021-03-14 10:47:15 -05:00
Eric Weiss
04823be518 return position (#188) 2021-03-14 10:43:52 -05:00
Tassadar2499
36accc72c6 F# and C# addings (#189)
* F# - Binary Search

* C# - Double selection sort

* quick sort - f#
2021-03-14 10:43:28 -05:00
Kostarev Kirill
fec65db129 Few changes in Swift Code (#191)
* Replaced the confusing construction

* The algorithm works faster than the previous version
2021-03-14 10:42:14 -05:00
Aditya Bhargava
f1acf84f3a Merge pull request #176 from AndriiNyzhnyk/clear_rust_example
Rust. Clear not needed boilerplate.
2020-09-14 12:53:54 -05:00
Aditya Bhargava
de9146234d Merge pull request #174 from FoxyChmoxy/master
Python: Unit tests for Binary Search
2020-09-14 12:53:11 -05:00
Andrii Nyzhnyk
58f1a6e325 clear not needed boilerplate and add author name for the first example 2020-08-23 22:31:33 +03:00
Almas Zaurbekov
977000eb86 python: unit tests for binary search 2020-08-13 01:50:19 +06:00
seanyu4296
23f31b4f3f Cleanup packages dhall and remove notes 2020-08-04 11:32:03 +00:00
seanyu4296
3f693b8cf2 update package set 2020-07-31 07:10:55 +00:00
seanyu4296
1a3782d950 update readme with link to main repo 2020-07-31 07:08:50 +00:00
seanyu4296
a59a2b8886 Fix Readme module name 2020-07-31 07:02:40 +00:00
seanyu4296
ad8e62d690 Add purescript solution for chapt 1 2020-07-31 06:58:43 +00:00
Giorgio
d8da439590 implement recursive binary serach in rust (#93) 2019-11-12 09:19:36 -06:00
Massoud Afrashteh
9dc7611411 Julia samples (#108)
* Add julialang binary search sample

* Add unit test

* Add julialang selection sort sample

* Change julia suffix to jl

* Add recursion and quick sort with tests

* add quick sort

* Add hash table samples

* Add BFS

* Changed file names

* Add dijkstras

* Add Dijkstras test
2019-11-12 09:19:21 -06:00
Michael Mkwelele
0377eab73c Add tests for the binary search implementation. (#110) 2019-11-12 09:19:00 -06:00
Felice Forby
4c3bc702f4 Add recursive binary search for ruby (ch. 1) and improve recursive max for ruby (ch. 4) (#113)
* add recursive binary search for ruby

* account for cases with empty lists and lists with only one item

* use p instead of print to show nil value

* add newline at end of file
2019-11-12 09:18:34 -06:00
Evgeniy
ee7dcd3b3d Update 02_recursive_binary_search.js (#125) 2019-10-30 16:31:50 -05:00
Alex
c23ca90b83 update binarySearch function for es6 recursive (#101) 2019-03-28 14:52:08 -07:00
Alex
c745f5d2a7 add code for chapters 1 and 2 in ts (#102) 2019-03-28 14:51:48 -07:00
Massoud Afrashteh
62c3b39668 Add julialang binary search sample (#107)
* Add julialang binary search sample

* Add unit test
2019-03-28 14:50:48 -07:00
Oleg A. Glushko
06ee65d9e5 Please, merge my PowerShell examples for all chapters (#106)
* PowerShell 01_introduction_to_algorithms example

* PowerShell 02_selection_sort example

* PowerShell 03_recursion examples

* PowerShell 04_quicksort examples

* PowerShell 05_hash_tables examples

* PowerShell 06_breadth-first_search example

* PowerShell 07_dijkstras_algorithm example

* PowerShell 08_greedy_algorithms example

* Powershell 09_dynamic_programming example
2019-03-28 14:49:20 -07:00
i-s-o-g-r-a-m
31412a0b96 Add binary search in OCaml (#90) 2018-10-18 08:27:27 -07:00
umatbro
7dc9e95d2a add c++11 (#87)
* binary search c++

* selection sort c++11

* c++ recursive countdown

* c++ recursion

* c++ quicksort

* rename folder names to c++11

* add another version of binary_search function

* c++11 hash tables

* c++11 breadth-first search
2018-10-18 08:25:54 -07:00
Vidit
38f5b2792e Added c++ implementation (#85)
* Added c++ implementation

* Added Bfs implementation in c++
2018-10-18 08:25:23 -07:00
Artem Solovev
0d5d0164ce Added more implementations (JS) (#67)
* Added recursive binary search (JS)

* Added recursive selection sorting

* Added another loop implementation sum func by reduce (JS)

* Recursion reduced by one iteration

* Recursive binary search in ES6 added to appropriate folder

* JS files ordered by standards (ES4/ES6)

* Added hashtable implementation in JS

* Fixed typo with LENGTH prop

* Added Euclidian algorithm for two numbers and set of them

* Added universal selection sort

* Commented output

* Added ES6 version of Euclidean algorithm

* Converted from ES6 to ES5

* #69 Added search for LCS

* #69 added levenstein algorithm

* Removed excessive property

* Removed excessive file

* Removed excessive function calls

* Removed excessive file

* Removed excessive file

* Renamed

* Fixed indentation
2018-08-24 11:21:54 -07:00
sulinehk
e206a13153 Fix BinarySearch.go style by gofmt (#80)
* Fix BinarySearch.go style by gofmt

* Fix longest_common_subsequence.go style by gofmt
2018-07-25 11:01:40 -07:00
Arctic Wolf
68a20e35eb Update 01_binary_search.c (#74) 2018-07-18 16:01:24 -07:00
Xinhai Wang
522efcbc31 Update BinarySearch.go (#73)
fix bug(panic for empty array)
2018-07-18 16:00:44 -07:00
freedom5566
9744af50ed Add 01_binary_search.c (#68)
* Add 01_binary_search.c

* Update use sizeof and floor
2018-04-29 08:26:35 -07:00
biosta
f24b9a6e35 Binary search and selection sort in Perl
* Create 01_binary_search.pl

* Typo fixed in 01_binary_search.pl

* Create 01_selection_sort.pl
2018-04-20 08:21:28 -07:00
Alterevit
f47666f099 add binary search on kotlin 2018-04-20 08:20:32 -07:00
Evgeny Garlukovich
8ed03e73aa Add Elixir example for binary search 2018-04-20 08:18:52 -07:00
Aliaksandr
b515434b3f Fix haskell binarysearch (#51) 2018-02-03 11:56:41 -08:00
Danh Nguyen
1fa164c40e Resolve Issue #40: Python 2 print statements changed to use Python 3 print function (#50)
* Update 01_selection_sort.py

Updated last print statement for Python 3 print function.

* Update 01_countdown.py

Updated print statement to print function for Python 3.

* Update 05_quicksort.py

Updated print statement to print function for Python 3.

* Update 01_price_of_groceries.py

Condensed dictionary creation into one line, edited print statement to a print function for Python 3.

* Update 01_set_covering.py

Changed print statement to print function for Python 3.

* Update 01_binary_search.py

Changed print statements to print function for Python 3.
2018-02-03 11:15:07 -08:00
ryn1x
7d48d29139 add perl6 code for chapters 1-4 (#49) 2018-01-04 06:46:31 -08:00
Yossi Adler
ec2890a93d Add ES6 Examples to all chapters (#38)
* add ES6 example for binary search

* add ES6 example for selection sort

* add ES6 example for countdown

* add ES6 example for greet

* add ES6 example for factorial

* edit ES6 example for quicksort

* add ES6 example for loop sum

* add ES6 example for recursive sum

* add ES6 example for recursive count

* add ES6 example for recursive max

* add ES6 example for price of groceries

* add ES6 example for check voter

* add ES6 example for breadth-first search

* add ES6 example for dijkstras algorithm

* edit ES6 example for dijkstras algorithm

* edit ES6 example for set covering

* add ES6 example for longest common subsequence
2017-11-13 08:12:59 -08:00
chase-g
eec9c310ff Adding Scala example for Chapter 2 (#31)
* Add files via upload

* Update 01_countdown.scala

* Update 02_greet.scala

* Update 02_greet.scala

* Create scala

* Delete scala

* Add files via upload

* Add files via upload

* Add files via upload

* Update 01_selection_sort.scala

* Add files via upload
2017-10-13 08:37:51 -07:00
zhangjiong
e3016960ee Update 01_binary_search.lua 2017-08-27 14:25:58 -04:00
zhangjiong
dff0f33447 Add Lua code for chapter 1 2017-08-27 14:25:58 -04:00