if x - 1 >= 0:
tobj = Astar()
tobj.grid = copy.deepcopy(inMatrix.grid)
tobj.grid[x][y], tobj.grid[x - 1][y] = tobj.grid[x - 1][y], tobj.grid[x][y]
tobj.flag = "down"
tobj.gCost = inMatrix.gCost + 1
tobj.hCost = findHeuristicValue(tobj.grid)
tobj.fCost = tobj.gCost + tobj.hCost
neighbours.append(tobj)
if y + 1 <= len(inMatrix.grid) - 1:
tobj = Astar()
tobj.grid = copy.deepcopy(inMatrix.grid)
tobj.grid[x][y], tobj.grid[x][y + 1] = tobj.grid[x][y + 1], tobj.grid[x][y]
tobj.flag = "right"
tobj.gCost = inMatrix.gCost + 1
tobj.hCost = findHeuristicValue(tobj.grid)
tobj.fCost = tobj.gCost + tobj.hCost
neighbours.append(tobj)
return neighbours
def findHeuristicValue(inMatrix): # Comparing position of values of current matrix to the ones of desired matrix
h = 0
for i in range(0, len(inMatrix)):
for j in range(0, len(inMatrix)):
if inMatrix[i][j] != outputMatrix[i][j]:
h += 1
return h
def findBestMatrix(openList): # Select best matrix from open list and return it
bestmatrix = Astar()
mincost = float("inf")
for matrix in openList:
if matrix.fCost <= mincost:
mincost = matrix.fCost
bestmatrix = matrix
return bestmatrix
def printMatrix(matrix): # Formatting matrices
p = PrettyTable()
for row in matrix:
p.add_row(row)
return p.get_string(header=False, border=False)
def pathFinder():
openList = []
closedList = []
current = Astar()
current.grid = inputMatrix
openList.append(current)
steps = 0
print("Input Matrix -->") # Printing Input Matrix
print(printMatrix(current.grid))
print("Output Matrix -->") # Printing Output Matrix
print(printMatrix(outputMatrix))
print()
print()
while True:
current = findBestMatrix(openList)
openList.remove(current)
closedList.append(current)
print("Step {0}:".format(str(steps))) # Printing steps
print(printMatrix(current.grid)) # Printing matrices
print()
if findHeuristicValue(current.grid) == 0:
exit(0)
neighbourList = generateNeighbours(current) # Generating neighbours from the selected matrix
for neighbour in neighbourList:
if neighbour not in openList:
openList.append(neighbour) # Appending neighbours in the open list
steps += 1 # Incrementing steps
pathFinder()

I would like to add a rare algorithm to find the nth term of a fibonacci @i-vishi
Implement Algorithms using Ruby Language
Dated: Oct-07-2020
Regarding Delay in reviewing PR
Hello, everyone, I am one of the maintainer of this repository. I know most of the PRs are the part of hacktoberfest and most of you are worried will your PRs will be eligible for Hacktoberfest 2020 or not. Since, all the maintainers are busy, it will take some time to review all the PRs. We have to review each PR and it may take some time.
Also, the rules of Hacktoberfest have been changed to reduce spam PRs. There are many SPAM PRs with invalid code or no code. So, we have to review each PR one by one. Due to the changes in rules, the burden has been shifted to maintainers.
About adding and then removing hacktoberfest-accepted label, it was just to check and verify the eligibility of the label. Do not consider it as making your PR invalid.
All the PRs will be checked and reviewed
Thanks and Happy coding 💻 👨💻 👩💻 💻
implement all type of game theory algorithms
I will add segment tree implementation in java.
I am trying to clone this repo after forking but its giving me errors.
#1 add cpp, python, java or any language program, also try to save that program in respective algorithm folder
Add a README.md file inside the Searching Directory. The file should contain a table that has
- Columns of searching algorithms and programming languages(C, CPP, Python, Java, etc.)
- Add a row of each searching algorithm and mark a ✔️ with a LINK to code if it is currently implemented in the corresponding programming language, else leave the cell blank.
- Do it for each searching algorithm.
- You can also change file names as per the algorithm to simplify the task. But do not forget to follow the nomenclature as:
algorithm-name/ProgrammingLanguage/algorithm_code.extension
Refer to Sorting README and implement in the same manner.Refer to Markdown Cheatsheet or Makrdown Guide to get help with writing Markdown.
Example Scrrenshot is given below:

Why is PR is not getting merged to the main branch?. The last change that is merged is around 3 months old. is the repo not active?
write a program to find the strings that make lcsp length in any language
Implement Data structures and algorithms in Ruby, Go, C# and Rust
Algorithm to find centroid of a given tree.
Centroid of a Tree is a node which if removed from the tree would split it into a ‘forest’, such that any tree in the forest would have at most half the number of vertices in the original tree.
Language - C++
- Add description file for every algorithm in the repository.
- The file must be written in Markdown language.
- Name of file should be:
algorithm_name.md.
- Description file should be inside the algorithm's folder as:
ALGORITHM_NAME/algorithm_name.md.
- The file should contain the basic information about the algorithm, i.e., where, why and how it is used.
- It should also contain the pseudocode of the algorithm.
currently it works on CodeBlocks. Edit it such that it work on G++
I would like to contribute to the repository by writing the program for the famous subset sum problem for hacktoberfest. Kindly assign the issue to me :)
I would like to implement the Longest Increasing Subsequence problem using Binary Search and Dynamic Programming in worst-case complexity of N log N as a part of Hacktober Fest 2020.
Boruvka's algorithm to find Minimum Spanning Tree.
Language: C++
I want to a DP based problem. Please assign so that I may get started.
Mathematics/LCM/python/lcm.py is not an efficient algo . It is taking O(n) time whereas this time can be reduced to O(log(n))
I would like to contribute to the repository by writing the program for diagonal traversal of a binary tree. Kindly assign the issue to me :)
Recommend Projects
-
-
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
Personal AI Assistant
-
The Web framework for perfectionists with deadlines.
-
A PHP framework for web artisans
-
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
Some thing interesting about web. New door for the world.
-
A server is a program made to process requests and deliver data to clients.
-
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Some thing interesting about visualization, use data art
-
Some thing interesting about game, make everyone happy.
-
Recommend Org
-
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Open source projects and samples from Microsoft.
-
Google ❤️ Open Source for everyone.
-
Alibaba Open Source for everyone
-
Data-Driven Documents codes.
-
China tencent open source team.
-