Algorithms_in_C 1.0.0
Set of algorithms implemented in C.
|
Encode a null terminated string using Run-length encoding More...
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
Functions | |
char * | run_length_encode (char *str) |
for IO operations More... | |
static void | test () |
Self-test implementations. More... | |
int | main () |
Main function. More... | |
Encode a null terminated string using Run-length encoding
Run-length encoding is a lossless compression algorithm. It works by counting the consecutive occurences symbols and encodes that series of consecutive symbols into the counted symbol and a number denoting the number of consecutive occorences.
For example the string "AAAABBCCD" gets encoded into "4A2B2C1D"
int main | ( | void | ) |
char * run_length_encode | ( | char * | str | ) |
for IO operations
for string functions for malloc/free for assert
Encodes a null-terminated string using run-length encoding
str | String to encode |
|
static |
Self-test implementations.