Commit Graph

45 Commits

Author SHA1 Message Date
Artem Chernyak
741c11bac6 add rust breadth first search (#293) 2024-12-07 07:36:33 -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
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
Matvey
70d4d231bf Fix/Python 06 bfs: case when entrypoint is target (#203)
* Simplify cognitive complexity

* Fix case when entrypoint is target

* Simplyfy check for case: entrypoint is target
2022-11-18 15:27:29 -06:00
NikitaLipatov
64a09d6584 05 & 06 exercises (#114)
Co-authored-by: Aditya Bhargava <bluemangroupie@gmail.com>
2022-11-18 14:34:48 -06:00
Dani El-Ayyass
c1c68d9d2a improve 01_breadth-first_search.py (#195) 2021-03-14 10:39:59 -05:00
Aditya Bhargava
cb4b1e74b9 Merge pull request #160 from joeczar/patch-1
Create Scala Solutions
2020-09-14 10:54:55 -05:00
Aditya Bhargava
437d215a45 Merge pull request #153 from TimoSci/bfs
Bfs
2020-09-14 10:52:27 -05:00
Aditya Bhargava
0d4a806c14 Merge pull request #135 from Alexandrshy/issues-134-formatting-problems-hash-tables
Fixed formatting problems
2020-09-14 10:47:23 -05:00
Joe Czarnecki
43fb096e64 removed an extra if clause 2020-03-06 14:39:52 +01:00
Joe Czarnecki
4e5867cff1 Update Scala Solutions 2020-03-03 16:54:25 +01:00
Joe Czarnecki
a6502e0af0 Update Scala Solutions 2020-03-03 16:46:16 +01:00
Joe Czarnecki
696a657c6f Create Scala Solutions
I've been working through the book and I was surprised to see there wasn't a Scala Solution here. I created a mutable version as close to the original as possible and immutable recursive version.
2020-03-03 16:16:49 +01:00
TimoSci
ff7ae962c1 edit comments 2019-12-08 13:31:33 +01:00
TimoSci
1f6cf7d460 avoid use of global variables; it is more rubyish to represent a graph as a class 2019-12-08 13:07:44 +01:00
TimoSci
70ddf46cb3 represent record of searched verices as a hash for O(1) lookup 2019-12-08 12:56:36 +01:00
TimoSci
b65c3de283 separate search functionality from seller checking fucntionality according to single responsibility principle 2019-12-08 12:40:40 +01: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
bigpas
6b9faa9cab fix: naming convention. Min. refactor (#116)
* fix: naming convention. Min. refactor

* add: 05 for Kotlin
2019-11-12 09:18:17 -06:00
Alexander Danilchenko
4bc8132647 Update 01_breadth-first_search.cpp (#124)
Improved code stylistic integrity.
2019-10-30 16:32:05 -05:00
Alexandrshy
a1dbe470cc Fixed formatting problems, added JSDoc, added example for JS, fixed example for JS 2019-07-24 09:25:02 +04:00
Yusuf Qedan
cc845c40f7 make search return true when mango seller is found (#99) 2019-03-28 14:53:30 -07:00
Max Beatty
5b675cc2e8 Complete "longest common ..." examples (#100)
* no else return

* fix var ref

* fix importing/requiring dependencies

* complete longest common examples
2019-03-28 14:52:55 -07:00
Alex
393b8e135d Add code for chapter 6 in ts (#105) 2019-03-28 14:51:05 -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
Chihwei-Hsu
33a65829c0 change print to python3 (#95) 2018-12-28 08:25:31 -08: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
sulinehk
a5fe9178dd Add 06_breadth-first_search Golang example (#81) 2018-08-24 11:20:41 -07:00
Vish511
57dd4e1756 Implementation of breadth first search in Golang (#83)
* Implementation of breadth first search in Golang

* fixed package name in go lang implementation of breadth first search

* fixed package name in go lang implementation of breadth first search
2018-08-24 11:19:39 -07:00
chenyang929
d13ab114f8 Update 01_breadth-first_search.py (#75)
change line 24 to make more pythonic style
2018-05-15 11:54:59 -07:00
Alterevit
ea74644c95 add binary search on kotlin 2018-04-20 08:20:32 -07:00
Evgeny Garlukovich
e8c1881566 Add Elixir example for breadth-first search 2018-04-20 08:18:52 -07:00
miholeus
7b3eab5f5a php example of breadth-firsth search (#58) 2018-03-19 09:49:30 -07:00
zhangjiongwx
d0ac45bcde Add Lua code for chapter 6-9 (#36)
* Add Lua code for chapter 6

* Add Lua code for chapter 7

* Add Lua code for chapter 8

* Add Lua code for chapter 9
2017-11-13 08:14:24 -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
Rytikov Dmitrii
88cf645af9 add es6 code for breadth-first-search 2017-10-13 08:38:23 -07:00
Bijoy Thomas
6f78bdf3d7 Adding Haskell examples (#17)
* Adding binary search example for Haskell

* Adding selection sort example in Haskell

* Adding Haskell examples for chapter 3

* Adding examples for chapter 4

* Adding examples for chapter 5

* Adding git ignore

* Add Haskell example for BFS
2017-06-11 19:12:48 -04:00
Oleh Novikov
4631b7a156 add examples in java 8 (#12)
* code for chapters 3-9 in Java

* code for chapters 1 in Java

* code for chapter 2 in Java

* missing CheckVoter for chapter 5 in Java

* add missing sample output for SetCovering as a comment
2017-03-20 09:06:45 -07:00
Anthony Marchenko
12265a8c61 Add examples on Swift 3.0.2 (#11)
* 01_binary_search Swift 3.0.2

* 01_binary_search Swift 3.0.2

* add Chapter 2 - 01_selection_sort Swift 3.0.2 example

* 01_binary_search cosmetic note updates Swift 3.0.2

* 03_recursion Swift 3.0.2 examples

* 04_quicksort Swift 3.0.2 examples

* fix typo on quicksort example. Swift 3.0.2

* add  05_hash_tables examples on Swift 3.0.2

* add 01_breadth-first_search Swift 3.0.2 example

* 01_breadth-first_search fixing typo Swift 3.0.2

* add 01_dijkstras_algorithm on Swift 3.0.2

* add 08_greedy_algorithms Swift 3.0.2 example

* 01_longest_common_subsequence Swift 3.0.2 example
2017-03-15 16:05:38 -07:00
Jim Vaughan
62ed616954 add csharp examples (#10) 2016-11-07 13:43:30 -08:00
Kevin Nguyen
29a9e7c131 code for chapter 6 in javascript 2016-06-21 21:52:26 -07:00
Leon Rische
da6478b78d code for chapter 6 in ruby 2016-03-03 15:53:40 +01:00
Aditya Bhargava
634b54ba57 code for chapter 6 2016-03-02 14:55:55 -08:00