TheAlgorithms / C-Sharp

All algorithms implemented in C#.
GNU General Public License v3.0
7.12k stars 1.52k forks source link

Added BalancedParenthesesChecker.cs, NextGreaterElement.cs and ReverseStack.cs #473

Closed mohit-gogitter closed 1 month ago

mohit-gogitter commented 1 month ago

Description

I have created stack-based utility classes in C# that can be used by other developers in their solutions. This utility provides commonly used operations related to stacks, which can be beneficial for solving various problems such as expression evaluations, balanced parentheses, or maintaining a history of operations.

These classes can be used to perform below stack-related operations: Next Greater Element: Given an array, find the next greater element for each element in the array. Balanced Parentheses Checker: A utility to check whether a given expression has balanced parentheses. Reverse a Stack: Function to reverse a stack.

CheckList:

siriak commented 1 month ago

Please put separate algorithms in separate classes with descriptive names and check if they are already implemented in the repository

mohit-gogitter commented 1 month ago

@siriak As suggested, i have created separate classes for algorithms and removed redundant code

mohit-gogitter commented 1 month ago

@siriak Moved to Algorithms project, Added Tests, fixed codacy and build issues. Kindly review

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 98.76543% with 1 line in your changes missing coverage. Please review.

Project coverage is 95.04%. Comparing base (cf19352) to head (a6732f9). Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
Algorithms/Stack/BalancedParenthesesChecker.cs 97.72% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #473 +/- ## ========================================== + Coverage 94.97% 95.04% +0.06% ========================================== Files 243 246 +3 Lines 10286 10367 +81 Branches 1464 1478 +14 ========================================== + Hits 9769 9853 +84 + Misses 398 395 -3 Partials 119 119 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.