Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

{- Carries out run-length encoding on input string. Run-length encoding is a simple form of data compression that replaces characters in a stream with the

{-

Carries out run-length encoding on input string.

Run-length encoding is a simple form of data compression that replaces

characters in a stream with the count of adjacent occurrences of that

character and just a single instance of the character itself. Write a

function that takes a string and returns a list of tuples reprenting the

run-length encoding of that string.

Examples:

runLengthEncode "aaaaaaabbb"

=> [(7,'a'),(3,'b')]

runLengthEncode "happy daaay"

=> [(1,'h'),(1,'a'),(2,'p'),(1,'y'),(1,' '),(1,'d'),(3,'a'),(1,'y')]

-}

runLengthEncode :: String -> [(Int,Char)]

runLengthEncode = undefined

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

What is the general rule on dealing with represented persons?

Answered: 1 week ago

Question

Convert to an improper fraction. 7. 16

Answered: 1 week ago

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago