-
Notifications
You must be signed in to change notification settings - Fork 497
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
LinkedList [C#] #475
LinkedList [C#] #475
Conversation
Hi! Thanks for showing interest in contributing to this repository. Please make sure that you have ticked the points mentioned in PR description correctly. Thanks again! |
Yes, I realize you cant run a static method inside a generic class.
The check error was so simple (the compiler clearly told me what it was), however it took me over an hour to figure out. |
print(n) | ||
|
||
if __name__ == '__main__': | ||
graph = {0: [1, 2], 1: [2, 0], 2: []} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
Origin: SpaceConsistencyBear, Section: python spacing
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpisevponc/breadth_first_search/BreadthFirstSearch.py
+++ b/tmp/tmpisevponc/breadth_first_search/BreadthFirstSearch.py
@@ -16,7 +16,7 @@
print(n)
if __name__ == '__main__':
- graph = {0: [1, 2], 1: [2, 0], 2: []}
+ graph = {0: [1, 2], 1: [2, 0], 2: []}
bfs(graph, 1) # 1 2 0
graph2 = {0: [1, 3], 1: [3, 2], 2: [2, 1], 3: []}
@@ -0,0 +1,31 @@ | |||
import collections |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
Origin: PEP8Bear, Section: pep8
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpisevponc/breadth_first_search/BreadthFirstSearch.py
+++ b/tmp/tmpisevponc/breadth_first_search/BreadthFirstSearch.py
@@ -1,4 +1,5 @@
import collections
+
def bfs(graph, root):
returnprint = 'BFS Order: '
seen.add(node) | ||
queue.append(node) | ||
print(returnprint) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
Origin: PEP8Bear, Section: pep8
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpisevponc/breadth_first_search/BreadthFirstSearch.py
+++ b/tmp/tmpisevponc/breadth_first_search/BreadthFirstSearch.py
@@ -11,6 +11,7 @@
seen.add(node)
queue.append(node)
print(returnprint)
+
def visit(n):
print(n)
|
||
def visit(n): | ||
print(n) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
Origin: PEP8Bear, Section: pep8
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpisevponc/breadth_first_search/BreadthFirstSearch.py
+++ b/tmp/tmpisevponc/breadth_first_search/BreadthFirstSearch.py
@@ -15,9 +15,10 @@
def visit(n):
print(n)
+
if __name__ == '__main__':
- graph = {0: [1, 2], 1: [2, 0], 2: []}
- bfs(graph, 1) # 1 2 0
+ graph = {0: [1, 2], 1: [2, 0], 2: []}
+ bfs(graph, 1) # 1 2 0
graph2 = {0: [1, 3], 1: [3, 2], 2: [2, 1], 3: []}
bfs(graph2, 2) # 2 1 3
bfs(graph, 1) # 1 2 0 | ||
|
||
graph2 = {0: [1, 3], 1: [3, 2], 2: [2, 1], 3: []} | ||
bfs(graph2, 2) # 2 1 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
Origin: PEP8Bear, Section: pep8
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpisevponc/breadth_first_search/BreadthFirstSearch.py
+++ b/tmp/tmpisevponc/breadth_first_search/BreadthFirstSearch.py
@@ -20,7 +20,7 @@
bfs(graph, 1) # 1 2 0
graph2 = {0: [1, 3], 1: [3, 2], 2: [2, 1], 3: []}
- bfs(graph2, 2) # 2 1 3
+ bfs(graph2, 2) # 2 1 3
graph3 = {0: [1, 2], 1: [2, 3], 2: [3, 4], 3: [4, 0], 4: []}
bfs(graph3, 1) # 1 2 3 4 0
bfs(graph2, 2) # 2 1 3 | ||
|
||
graph3 = {0: [1, 2], 1: [2, 3], 2: [3, 4], 3: [4, 0], 4: []} | ||
bfs(graph3, 1) # 1 2 3 4 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
Origin: PEP8Bear, Section: pep8
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpisevponc/breadth_first_search/BreadthFirstSearch.py
+++ b/tmp/tmpisevponc/breadth_first_search/BreadthFirstSearch.py
@@ -23,9 +23,10 @@
bfs(graph2, 2) # 2 1 3
graph3 = {0: [1, 2], 1: [2, 3], 2: [3, 4], 3: [4, 0], 4: []}
- bfs(graph3, 1) # 1 2 3 4 0
+ bfs(graph3, 1) # 1 2 3 4 0
- graph4 = {0: [1, 3], 1: [3, 2], 2: [2, 4], 3: [4, 3], 4: [4, 0], 5: [0, 1], 6: []}
- bfs(graph4, 0) # 0 1 3 2 4
+ graph4 = {0: [1, 3], 1: [3, 2], 2: [2, 4],
+ 3: [4, 3], 4: [4, 0], 5: [0, 1], 6: []}
+ bfs(graph4, 0) # 0 1 3 2 4
- bfs(graph4, 2) # 2 4 0 1 3
+ bfs(graph4, 2) # 2 4 0 1 3
linked_list/LinkedList.cs
Outdated
this.head = null; | ||
} | ||
|
||
public void addFront(T obj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Pascal Case for Method names.
ref: https://msdn.microsoft.com/en-us/library/4df752aw(v=vs.71).aspx
linked_list/LinkedList.cs
Outdated
this.size++; | ||
} | ||
|
||
public void addLast(T obj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Pascal Case for Method names.
linked_list/LinkedList.cs
Outdated
} | ||
} | ||
|
||
public void add(T obj, int index) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Pascal Case for Method names.
linked_list/LinkedList.cs
Outdated
} | ||
} | ||
|
||
public T removeFront() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Pascal Case for Method names.
linked_list/LinkedList.cs
Outdated
return objRemoved; | ||
} | ||
|
||
public T remove(int index) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Pascal Case for Method names.
linked_list/LinkedList.cs
Outdated
return removeFront(); | ||
} | ||
|
||
public T removeLast() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Pascal Case for Method names.
linked_list/LinkedList.cs
Outdated
return objRemoved; | ||
} | ||
|
||
public int search(T obj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Pascal Case for Method names.
linked_list/LinkedList.cs
Outdated
return this.size; | ||
} | ||
|
||
public bool isEmpty() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Pascal Case for Method names.
linked_list/LinkedList.cs
Outdated
return -1; | ||
} | ||
|
||
public int getSize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Pascal Case for Method names.
Added Pascal Case :) |
Yeah GitMate broken :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also make a new entry for Linked List[C#] in the README file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@ransty: Thanks for the contribution :) |
Fixes #474
By submitting this pull request I confirm I've read and complied with the below declarations.
Added {Algorithm/DS name} [{Language}]
, notUpdate README.md
orAdded new code
.