jueves, 21 de febrero de 2013

Homework 2 - String matching

For this week, was commissioned a "string matching" with the implementation of the algorithms of Boyer-Moore and Knuth-Morris-Pratt.

Note*: Only apply the Boyer-Moore algorithm and basic algorithm

Operation:

The program runs in a terminal, as the first argument we give the number of letters for the random text in the second argument and give the number of letters for the random pattern.

Code:


Program Running: 

Results:

Now, the simulation is as follows:

Simulation:

....

No Results :(

Note*: Code issues

Repository

jueves, 14 de febrero de 2013

Homework 1 - Noisy Channel

For this week, was commissioned a program to simulate a noisy channel, built in python to generate a conversion of zeros and ones given the input, for data transmission on the channel, then analyze the data.

Operation:

The program works by terminal, we first as argument the length of the word, then put the following argument amount to generate zeros, then the probability of receiving argument zeros and then the receiving one, finally the argument many reps per word

Code:
Program running:

Image:
Image 2:


Repository

viernes, 8 de febrero de 2013

Activity Points Extras - Probability Exercise

Perform the following exercise:

Exercise 1.3.2
(Exercise taken from the PDF:)

Traduccion:

1.3.2 Una urna contiene 6 bolas rojas, 5 bolas verdes y 3 bolas amarillas, 3 bolas sin reemplazo. ¿Cual es la probabilidad de que una bola sea amarilla?.

Solution:


First, we have the color sequence and represent with letters, for example:

Red = R
Green = G
Yellow = Y

We add the balls in total, it is 14, now, we get the chance, we have 3 yellow balls out of 14 balls in total, is as follows:

P ( Y ) = 3/14 

We describe the most important events that can happen, to get as many yellow probability on each play we get

P = {YYY, YYR, YRG .....}

We have that on the first play I can get 3 yellow, the second two yellow and one red, one yellow in the third, one red and one green.

We select the three most important events and multimplicamos by probabilities, we have:
And the likelihood is:
We have that the probability of drawing a yellow ball is 3/364 opportunities

Referencias:

  • http://www.amazon.com/exec/obidos/ISBN=0849339855