Commit Graph

26 Commits

Author SHA1 Message Date
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
Aditya Bhargava
788c54e92b python lcs example needs to default to 0 if values dont match 2022-11-18 14:55:06 -06:00
Pikachu
06a890c302 A pull request from cx (#164)
* The original code did not consider the exit condition when the stations cannot perfectly cover the states_needed.

* The code in 09_dynamic_programming/python/01_longest_common_subsequence.py is completed. And the 02_longest_common_substring.py is added.
2022-11-18 14:49:50 -06:00
Aditya Bhargava
34a907f236 Merge pull request #155 from vlada1001/master
Added ".cpp" extension
2020-09-14 10:53:12 -05:00
Aditya Bhargava
a5d9073242 Merge pull request #143 from Alexandrshy/issues-142-formatting-problems-and-example-for-dynamic-programming
Fixed formatting problems, added JSDoc, deleted duplicate example
2020-09-14 10:48:50 -05:00
Vladimir Pavlovic
d771cb21a0 Rename 01_longest_common_subsequence to 01_longest_common_subsequence.cpp 2020-01-03 00:46:37 +01:00
Alexander Danilchenko
d889159744 Added C++ Solution for 9th chapter (#146)
* Added C++ Solution for 9th chapter

* Fixed extra space

* Fixed another extra space

* Output style correction
2019-10-30 16:30:31 -05:00
Alexandrshy
a76c5e5d7d Fixed formatting problems, added JSDoc, deleted duplicate example 2019-07-27 02:00:06 +04:00
Yuriy Marad
bac32b613b Add PHP example for chapter 09 - dynamic programming (#98) 2019-03-28 14:53:48 -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
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
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
Evgeny Garlukovich
2ff9912e77 Add Elixir example for longest common subsequence 2018-04-20 08:18:52 -07:00
Bijoy Thomas
542f4ab0a0 Added Haskell example for Dijkstras algorithm (#18)
* 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

* resetting

* Adding haskell example for dijkstras algorithm

* Adding Haskell example for chapter 8

* Adding power set based solution for set covering problem

* Adding Haskell examples for chap 9
2017-11-13 08:16:12 -08:00
Seoungtae Kim
1ab56fce62 Selection_Sort Golang (#35)
* recursion_Golang

* go_fmt

* selection_sort_Golang

* rm-golang

* selection_sort_Golang

* selection_sort_Golang

* selection_sort_Golang

* dynamic_golang
2017-11-13 08:14:44 -08: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
yepstepz
67dc8de543 Added examples with diffing two words for chapter 09_dynamic_programming 2017-06-24 11:45:53 -04:00
Yury Polshchikov
0a2ed9e4bb Update LongestCommonSubsequence.java
for example from the book with words 'fish' and 'fosh' where is a mistake.
2017-06-11 19:16:08 -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
8181b2609f code for chapter 9 in javascript 2016-06-21 21:52:26 -07:00
Leon Rische
7a2d6d8d77 code for chapter 9 in ruby 2016-03-03 16:17:37 +01:00
Aditya Bhargava
2a01a0f546 code for chapter 9 2016-03-02 15:11:32 -08:00