-
-
Notifications
You must be signed in to change notification settings - Fork 359
Enhance the code of TreeTraversal and EuclideanAlgorithm for C# #120
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
Merged
june128
merged 5 commits into
algorithm-archivists:master
from
june128:enhanceExamplesPR
Jun 28, 2018
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
522a058
Add all additional methods from TreeTraversalMdAdditional to TreeTrav…
june128 741f983
Delete redundant EuclideanAlgorithmMdAdditional.
june128 3134b20
Make EuclideanAlgorithm non-static.
june128 ed2415f
Make file be "ASCII text" instead of "UTF-8 Unicode (with BOM) text, …
june128 7041652
Provide explanation for commented lines of code.
june128 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 0 additions & 31 deletions
31
...lidean_algorithm/code/cs/EuclideanAlgorithmMdAdditional/EuclideanAlgorithmMdAdditional.cs
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
chapters/euclidean_algorithm/code/cs/EuclideanAlgorithmMdAdditional/Program.cs
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// submitted by Julian Schacher (jspp) | ||
using System; | ||
|
||
namespace TreeTraversal | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Console.WriteLine("TreeTraversal"); | ||
var tree = new Tree(3, 3); | ||
Console.WriteLine("DFSRecursive:"); | ||
tree.DFSRecursive(); | ||
Console.WriteLine("DFSStack:"); | ||
tree.DFSStack(); | ||
Console.WriteLine("BFSQueue:"); | ||
tree.BFSQueue(); | ||
Console.WriteLine("DFSRecursivePostorder"); | ||
tree.DFSRecursivePostorder(); | ||
// Uncommenting the following 2 lines will result in an exception thrown because at least one Node of the Tree has more than 2 children and therefor a DFSRecursiveInorderBinary doesn't work. | ||
// Console.WriteLine("DFSRecursiveInorder (fail)"); | ||
// tree.DFSRecursiveInorderBinary(); | ||
tree = new Tree(3, 2); | ||
Console.WriteLine("DFSRecursiveInorder (succeed)"); | ||
tree.DFSRecursiveInorderBinary(); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
chapters/tree_traversal/code/cs/TreeMdAdditional/Program.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm not a C# expert, but I'm pretty sure that omitting brackets for loops and conditions is dangerous no matter which language you're using.
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.
@Gustorn What do you think about that?
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.
It can be dangerous, sure, but C#'s bracket style kinda encourages it. Having a single-line statement stretch into 3 eats up a lot of vertical space. I don't really mind either way but as long as it's a short, single line I think omitting the parens is fine
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.
I shall allow it, then.