Questions tagged [run-length-encoding]

Run-length encoding (RLE) is a very simple form of data compression in which runs of data (that is, sequences in which the same data value occurs in many consecutive data elements) are stored as a single data value and count, rather than as the original run.

Run-length encoding is most useful on data that contains many such runs: for example, simple graphic images such as icons, line drawings, and animations. It is not useful with files that don't have many runs as it could greatly increase the file size.

254 questions
-1
votes
3 answers

RunLength Decoding in C

This is my program for RunLength Decoding. But is is giving output as garbage values. The output in the char *decode_rle(char *a,int length) method is correct, but when it is returned to the main function it is wrong.…
Sarath S Nair
  • 603
  • 2
  • 14
  • 29
-1
votes
3 answers

java byte vs c++ BYTE

I know Java byte range is -128 to 127, but C++ BYTE is a unsigned char (0 to 255.) I want to convert a C++ function to Java, and in C++ I have a LPBYTE (which is a pointer to BYTE array.) I've tried using byte array instead of LPBYTE in C++…
Bahram
  • 1,464
  • 2
  • 22
  • 38
-1
votes
1 answer

C# LinkedList vs List for Run Length Encoding?

Which one of these would be more suitable for RLE on bytes? I need to be able to insert data in the list reasonably quickly, but I also need to be able to find out where say uncompressed byte 3987 quickly (this is probably more important, I'd…
Levi H
  • 3,426
  • 7
  • 30
  • 43
-2
votes
1 answer

Using javascript decipher a string from aaabccdd to a3b1c2d2?

I tried this approach but I was not getting the first element of the string. I tried to convert in the opposite way which was way too easy. But in this one somehow I am missing something. Question is, we need to decipher a string from "aabbcdd" to…
-2
votes
1 answer

calculate numbers in array (run length decoding)

int[] bytes = new int[9] { 123, 5, 65, 123, 6, 77, 123, 4, 101 }; int count = 1; for (int i = 1; i < bytes.Length; i++) { if (bytes[i] == 123) { …
powerYY
  • 3
  • 1
-2
votes
1 answer

How to write a compressed alphanumeric program

I need to write a program which would take an alphanumeric string as input. The string would contain only lower case characters and number from 0 to 9. I have to compress the alphabets as alphabets multiplied by number of times continous repetition,…
-2
votes
1 answer

run-length encoding using C++

I have a text file with a string which I'd like to encode. Let's say it is: aaahhhhiii kkkjjhh ikl wwwwwweeeett and here is the code: void Encode(std::string &inputstring, std::string &outputstring) { for (int i = 0; i < inputstring.length();…
liasis
  • 21
  • 1
  • 5
-2
votes
2 answers

Run length encoding of the symbols in list with using scheme language

I am trying to find frequency of the letters in a list with using scheme language but I can not do it for 4 days, and code must be work in repl.it For example, our list is (a a a a b c c a a d e e e e) our output should be (4 a ) b ( 2 c ) ( 2…
-2
votes
1 answer

How to read sqlite and decode run length encoded format in python?

I am reading sqlite file having run length encoded format. code.py import sqlite3 conn = sqlite3.connect("data.sqlite3") #print(conn) it prints object but decode function works on array instead of object also i don't have table name. c =…
Manish
  • 3,341
  • 15
  • 52
  • 87
-3
votes
1 answer

Run length decompression python

I'm trying to make a run length decoder that doesn't use 1s. For example a string that could be passed through would be something like ''' A2C3GTA'''. I made what i thought would work and am having trouble finding where I went wrong. I'm a beginner…
808Blues
  • 87
  • 1
  • 4
-3
votes
2 answers

How to set my decode function to take in the encoded string?

I'm working on my decode function and I've hit a wall. I dont know if I should pass in the encode function or create a class. My encode function compresses a string, I need the decode function to take that encoded string and expand it. I've been…
Lizan
  • 1
  • 4
-3
votes
2 answers

Problem with a run-length encoding program c++

I am trying to make a code that does run=length encoding based on the value entered by the user. Only accepts lower-case letters. Using two vectors. The problem is it doesn't with all examples: Example: zzzzzzzz output: (terminate called after…
J. Doe
  • 13
  • 4
-4
votes
1 answer

How to do run length encoding in python for a specific pattern of output? (without using groupby and lists for output)

Need to write a python function which performs the run length encoding for a given string and returns the run length encoded String. Went through various posts in Stack Overflow and other websites in Google to get a proper understanding in Run…
-4
votes
1 answer

How to compress strings. For ex: aaabbbccc -> a3b3c3

I have a function which takes a string of lowercase letters (a-z) and returns a compressed string or the original string if the length of the compressed string is not less than the original. For ex: aaabbbccc -> a3b3c3, abejd -> abejd I'm having…
000
  • 99
  • 1
  • 8
1 2 3
16
17