59 Commits

Author SHA1 Message Date
Christine P. Chai
ceea225d2e added selection sort for R (#301) 2025-05-01 18:30:45 -05:00
Vladyslav
9ed0658636 Fix typo in variable name in selection sort example (#304) 2025-05-01 18:25:03 -05:00
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
Timur Sevimli
45bf3c086d Increase readability, update code style and optimise for modern JavaScript (#273)
* Remove loops on recursive example, increase readability and optimise

* Update style and optimise

* Update 01_loop_sum_reduce_version.js

Update style

* Update style

* Rename identificators

* Rename identificators

* Convert shift to splice
2024-12-07 07:48:14 -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
Aditya Bhargava
775022b848 typo 2024-03-22 15:10:42 -05:00
ViMaCode
f7ccf02e00 Array variable (#259)
The array is set in one place.
2024-03-22 15:10:02 -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
Nikita
4d324e464d small refactoring for better code readability (#247) 2023-07-19 10:51:10 -05:00
Pere Frontera
f53fe3b98a SelectionSort csharp using array as input (#226)
Co-authored-by: Pere <pere.frontera@fdsa.es>
2023-07-19 10:49:01 -05:00
Carlos
fa75dc144d Added #include <limits.h> to support the use of INT_MAX (#251) 2023-01-30 10:38:56 -06: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
Sergey Ivanov
3868623fcd Update SelectionSort2.java (#184)
* Update SelectionSort2.java

Small method

* Update SelectionSort2.java
2022-11-18 14:58:46 -06:00
Alexandr Shulaev
c029201ab1 Fixed formatting problems, example and JSDoc (#129) 2022-11-18 14:47:16 -06: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
75bf3017d0 Merge pull request #172 from seanyu4296/add-purescript-solution-for-chapter-1-chapter-2
Add purescript solution for chapter 1 chapter 2
2020-09-14 12:52:10 -05:00
Aditya Bhargava
7506a133f4 Merge pull request #162 from lamalex/selection-sort-in-rust
Add Rust examples to 02_selection_sort
2020-09-14 10:55:27 -05:00
seanyu4296
2f166a0ee1 Update selection sort 2020-08-05 12:58:43 +00:00
seanyu4296
23f31b4f3f Cleanup packages dhall and remove notes 2020-08-04 11:32:03 +00:00
seanyu4296
32fc3cec95 Add chapter 2 selection sort solution 2020-07-31 07:25:32 +00:00
Alexander Launi
b0414be22e Add Rust examples to 02_selection_sort 2020-03-21 15:20:34 -04:00
ZGennadiy
cad619574d Update selection sort ES6
Added copy values from original array, because it must be immutable. Without that after call selectionSort origin array will become empty.
2020-03-17 10:24:44 +03: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
Yury
9b0288d791 Update 02_recursive_selection_sort.js (#119) 2019-11-12 09:17:35 -06:00
Alexander Danilchenko
59ee067417 Update 01_selection_sort.js (#122) 2019-10-30 16:32:21 -05:00
Alex
c745f5d2a7 add code for chapters 1 and 2 in ts (#102) 2019-03-28 14:51: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
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
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
Денис
48f971e361 i start from 1 (#78) 2018-07-18 16:03:20 -07:00
Felix Yan
c55036458e Fix a typo in 01_selection_sort.swift (#76) 2018-07-18 16:01:51 -07:00
Ramit Mittal
b190829dfb resolve issue 70, correction in python selection sort (#72)
* Resolve Issue #40: Changed more examples to use python3 syntax

* corrected selection sort python
2018-04-29 08:27:42 -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
9723ed03cf add selection sort on kotlin 2018-04-20 08:20:32 -07:00
Evgeny Garlukovich
fa35ae875d Add Elixir example for selection sort 2018-04-20 08:18:52 -07:00
Lokesh Jadhav
bb4a8638f1 Typo in comment: Big O for selection sort (#61) 2018-03-19 09:51:48 -07:00
Wenxuan Zhou
bff0bbaaa2 Update 01_selection_sort.py (#59)
remove one line of code which is redundant
2018-03-19 09:51:07 -07:00
sliw
f9497eb344 Update Js (ES5, ES6) to make them consistent and explicit (#54)
* Update the names to make ES5 and ES6 solutions more consistent

I basically change the names to make the function more explicit and clear:

1. list to sortedList
2. mid to middle

* Revert "Update the names to make ES5 and ES6 solutions more consistent"

This reverts commit 46d7514636420eb3b3c581665eaa3c0aca9df99d.

* [selection sort] update Js (ES5, ES6) to make them more consistent and explicit
2018-02-03 11:59:16 -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
kde0820
a010e5c715 C selection sort (#46)
* Add C example for recursion

* Add loop_sum in c

* Add recursive_sum in c

* Add quicksort in c

* Add selection sort in c
2018-01-04 06:47:49 -08:00
ryn1x
7d48d29139 add perl6 code for chapters 1-4 (#49) 2018-01-04 06:46:31 -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
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
vendin
495a648a6a Adding PHP examples 2017-09-25 09:57:26 -07:00
Alexander R. Torrijos
8ec4dc010b Added PHP selection sort implementation 2017-09-07 09:43:48 -04:00
zhangjiong
88840a470f Add Lua code for chapter 2 2017-08-27 14:25:58 -04: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