Skip to content

Implementation of Run length encoding#163

Open
kowshikaRani wants to merge 3 commits into
TheAlgorithms:masterfrom
kowshikaRani:RunLengthEncoding
Open

Implementation of Run length encoding#163
kowshikaRani wants to merge 3 commits into
TheAlgorithms:masterfrom
kowshikaRani:RunLengthEncoding

Conversation

@kowshikaRani

@kowshikaRani kowshikaRani commented Nov 17, 2021

Copy link
Copy Markdown

Welcome to Dart community

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Dart files are placed inside an existing directory.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

//reference : https://www.geeksforgeeks.org/run-length-encoding/


String RunLengthEncoding(String str)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Improper function naming change to runLengthEncoding.

String RunLengthEncoding(String str)
{
int n = str.length;
String res="";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i improve file formatting


int main()
{
String str = "";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

add proper test cases instead of print statements.

int main()
{
String str = "";
var res = RunLengthEncoding(str);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Better to use proper types.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants