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

LinkedList [C#] #475

Merged
merged 13 commits into from
Oct 6, 2017
Merged

LinkedList [C#] #475

merged 13 commits into from
Oct 6, 2017

Conversation

ransty
Copy link
Contributor

@ransty ransty commented Oct 2, 2017

Fixes #474

By submitting this pull request I confirm I've read and complied with the below declarations.

  • I have read the Contribution guidelines and I am confident that my PR reflects them.
  • I have followed the coding guidelines for this project.
  • My code follows the skeleton code structure.
  • This pull request has a descriptive title. For example, Added {Algorithm/DS name} [{Language}], not Update README.md or Added new code.
  • This pull request will be closed if I fail to update it even once in a continuous time span of 7 days.

@singhpratyush
Copy link
Member

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!

@ransty
Copy link
Contributor Author

ransty commented Oct 2, 2017

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: []}
Copy link
Member

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
Copy link
Member

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)

Copy link
Member

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)

Copy link
Member

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
Copy link
Member

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
Copy link
Member

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

this.head = null;
}

public void addFront(T obj)
Copy link
Member

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

this.size++;
}

public void addLast(T obj)
Copy link
Member

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.

}
}

public void add(T obj, int index)
Copy link
Member

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.

}
}

public T removeFront()
Copy link
Member

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.

return objRemoved;
}

public T remove(int index)
Copy link
Member

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.

return removeFront();
}

public T removeLast()
Copy link
Member

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.

return objRemoved;
}

public int search(T obj)
Copy link
Member

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.

return this.size;
}

public bool isEmpty()
Copy link
Member

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.

return -1;
}

public int getSize()
Copy link
Member

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.

@ransty
Copy link
Contributor Author

ransty commented Oct 4, 2017

Added Pascal Case :)

@ransty
Copy link
Contributor Author

ransty commented Oct 4, 2017

Yeah GitMate broken :(

Copy link
Member

@mohitkyadav mohitkyadav left a 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.

Copy link
Member

@mohitkyadav mohitkyadav left a comment

Choose a reason for hiding this comment

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

👍

@singhpratyush singhpratyush merged commit c370aa8 into iiitv:master Oct 6, 2017
@singhpratyush
Copy link
Member

@ransty: Thanks for the contribution :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LinkedList [C#]
3 participants