Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Floyd Warshall [Java] #371

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .bin/install_apt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
sudo apt-get update
sudo apt-get install -y $(grep -vE "^\s*#" apt-requirements.txt | tr "\n" " ")
4 changes: 4 additions & 0 deletions .bin/install_go.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
go get -u github.com/golang/lint/golint
cd $GOPATH/src/github.com/golang/lint
go install .
2 changes: 2 additions & 0 deletions .bin/install_npm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
npm install -g $(grep -vE "^\s*#" npm-requirements.txt | tr "\n" " ")
60 changes: 60 additions & 0 deletions .bin/test_running.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't Include files that are not relevant to this PR

set -e

echo "Testing C files..."
for i in $(ls -1 **/*.c); do
echo " Compiling $i - gcc $i -lm -std=c11"
gcc $i -lm -std=c11
echo " Running $i - ./a.out > /dev/null"
./a.out > /dev/null
rm -f a.out
echo ""
done

echo ""
echo "Testing C++ files..."
for i in $(ls -1 **/*.cpp); do
echo " Compiling $i - g++ $i -lm -pthread -std=c++11"
g++ $i -lm -pthread -std=c++11
echo " Running $i - ./a.out > /dev/null"
./a.out > /dev/null
rm -f a.out
echo ""
done

echo ""
echo "Testing Java files..."
for i in $(ls -1 **/*.java); do
echo " Compiling $i - javac -Werror -Xlint:all $i -d ."
javac -Werror -Xlint:all $i -d .
filename="${i##*/}"
classname="${filename%.*}"
echo " Running $i - java $classname > /dev/null"
java $classname > /dev/null
echo ""
done
rm -f *.class

echo "Testing Python files..."
for i in $(ls -1 **/*.py); do
echo " Running $i - python2 $i > /dev/null"
python2 $i > /dev/null
echo " Running $i - python3 $i > /dev/null"
python3 $i > /dev/null
echo ""
done

echo ""
echo "Running Go files..."
for i in $(ls -1 **/*.go); do
echo " Running $i - go run $i > /dev/null"
go run $i > /dev/null
echo ""
done

echo ""
echo "Running JavaScript files..."
for i in $(ls -1 **/*.js); do
echo " Running $i - node --use-strict --harmony $i > /dev/null"
node --use-strict --harmony $i > /dev/null
done
5 changes: 0 additions & 5 deletions .coafile
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,3 @@ bears = GhcModBear
[happiness]
files = **/*.js
bears = HappinessLintBear

# yaml
[yml]
files = **/*.yml
bears = YAMLLintBear
3 changes: 3 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ engines:
enabled: true
radon:
enabled: true
checks:
Complexity:
enabled: false
ratings:
paths:
- "**.js"
Expand Down
15 changes: 8 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true

[{*.go, *.c, *.cpp}]
charset = utf-8
[*.{go,c,cpp}]
indent_style = tab
tab_width = 4
trim_trailing_whitespace = true
Expand All @@ -15,16 +15,17 @@ indent_style = tab
tab_width = 2
trim_trailing_whitespace = true

[{*.py, *.java}]
charset = utf-8
[*.{py,java}]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.{c,cpp,java,js}]
block_comment_start = /*
block_comment = *
block_comment_end = */

[*.yml]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
.DS_Store
# coala
*.orig

# Jetbrains
.idea/
25 changes: 11 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
dist: trusty
language: python
python:
- "3.6"
sudo: required
language: node_js
node_js:
"7"

env:
GOPATH: $HOME/go
PATH: $GOPATH/bin:$PATH

install:
- sudo apt-get update
- sudo apt-get install golang-go
- sudo apt-get install ghc-mod hlint
- curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
- sudo apt-get install -y nodejs
- sudo npm install -g happiness
- go get -u github.com/golang/lint/golint
- cd $GOPATH/src/github.com/golang/lint
- go install .
- pip install coala-bears
- cd $TRAVIS_BUILD_DIR
- ./.bin/install_apt.sh
- ./.bin/install_go.sh
- ./.bin/install_npm.sh
- pip3 install -r pip3-requirements.txt
- pip2 install -r pip2-requirements.txt

script:
- ./.bin/test_running.sh
- coala --ci
- eclint check "**/*.{java,c,cpp,js}"
22 changes: 21 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* Filename should be derived from the folder name. (eg `longest_common_subsequence` becomes `longestCommonSubsequence.c` or `LongestCommonSubsequence.java`)
* Name of master function of the code should be kept same as filename to the best extent possible.
* Prefer classes instead of multiple helper functions (where applicable).
* Currently we are accepting contributions in C, C++, Java, Python and Go but other languages may be considered after a discussion.
* Currently we are accepting contributions in C, C++, Java, Python, Go and JavaScript but other languages may be considered after a discussion.
* Define `tester` code only in `main` routine.
* Use meaningful variable, method and function names and comments.
* No profanity.
Expand Down Expand Up @@ -137,3 +137,23 @@ func main() {
fmt.Println(sortedArray)
}
```

#### JavaScript

```JavaScript
function quickSort (arr) {
/*
Your implementation here
*/
}

function main () {
let input = [2, 3, 0, 4];
quickSort(input);
for (let x in input) {
console.log(input[x] + ' ');
}
}

main();
```
2 changes: 2 additions & 0 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
- [ ] I searched or browsed the repo’s other issues to ensure this is not a duplicate.
- [ ] This Algo/DS is worth adding to this repository.
- [ ] Assign this issue to me (I want to work on this).
- [ ] I ensure that I am not already assigned to 2 or more issues.
- [ ] I will send my PR only after I'm assigned to this issue by any maintainer.
- [ ] I understand that I will be unassigned from this issue if I fail to send a PR for this within a week.

<!-- It's not necessary for all for points to be checked, we will look upon what is required once you open an issue. -->

7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2017 IIITV GitHub Group

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading