Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

how to write this python code in C ? it is for this project ,Process P2 will be responsible to get data from P1 and

how to write this python code in C ?

it is for this project ,Process P2 will be responsible to get data from P1 and compress the obtained data. The compression scheme is called "Burrows-Wheeler Transform (BWT)". A description of the algorithm and its reference implementation in Python is found here

def suffixArray(s): satups = sorted([(s[i:], i) for i in range(len(s))]) return map(lambda x: x[1], satups)

def bwtViaSa(t): # Given T, returns BWT(T) by way of the suffix array bw = [] for si in suffixArray(t): if si == 0: bw.append('$') else: bw.append(t[si-1]) return ''.join(bw) # return string-ized version of list bw

image text in transcribedimage text in transcribed

1.2 BWT via the suffix arrav The Burrows-Wheeler Matrix seems to be related to the suffix array: to make a suffix array of T, SA(T), we sort T's suffixes, and to make BWM(T), we sort T's rotations. The relationship is clearer when we write them side by side BWM $abaaba 6 a$abaab 5 a$ aaba$ab 2 aaba$ aba$aba3 aba$ abaaba$ 0 abaaba$ ba$abaa4 ba$ baaba$a 1 baaba$ SA: Suffixes given by SA: They correspond to the same ordering. Look at, for example, where the Ss appear in each row of the comparison. So another way of defining BWTT) is via the suffix array SAT). Let BWTil denote the character at 0-based offset i in BWT(T) and let SAil denote the suffix at 0-based offset i in SA(T) 1.2 BWT via the suffix arrav The Burrows-Wheeler Matrix seems to be related to the suffix array: to make a suffix array of T, SA(T), we sort T's suffixes, and to make BWM(T), we sort T's rotations. The relationship is clearer when we write them side by side BWM $abaaba 6 a$abaab 5 a$ aaba$ab 2 aaba$ aba$aba3 aba$ abaaba$ 0 abaaba$ ba$abaa4 ba$ baaba$a 1 baaba$ SA: Suffixes given by SA: They correspond to the same ordering. Look at, for example, where the Ss appear in each row of the comparison. So another way of defining BWTT) is via the suffix array SAT). Let BWTil denote the character at 0-based offset i in BWT(T) and let SAil denote the suffix at 0-based offset i in SA(T)

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

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions