Finding terminal states in markov chain matrix (Simple project)

I want someone to solve this problem in either Java/python.

Write a function answer(m) that takes an array of array of nonnegative ints representing how many times that state has gone to the next state and return an array of ints for each terminal state giving the exact probabilities of each terminal state, represented as the numerator for each state, then the denominator for all of them at the end and in simplest form. The matrix is at most 10 by 10. It is guaranteed that no matter which state the elements is in, there is a path from that state to a terminal state. That is, the processing will always eventually end in a stable state. The elements starts in state 0. The denominator will fit within a signed 32-bit integer during the calculation, as long as the fraction is simplified regularly. For example, consider the matrix m:


[0,1,0,0,0,1], # s0, the initial state, goes to s1 and s5 with equal probability

[4,0,0,3,2,0], # s1 can become s0, s3, or s4, but with different probabilities

[0,0,0,0,0,0], # s2 is terminal, and unreachable (never observed in practice)

[0,0,0,0,0,0], # s3 is terminal

[0,0,0,0,0,0], # s4 is terminal

[0,0,0,0,0,0], # s5 is terminal


So, we can consider different paths to terminal states, such as:

s0 -> s1 -> s3

s0 -> s1 -> s0 -> s1 -> s0 -> s1 -> s4

s0 -> s1 -> s0 -> s5

Tracing the probabilities of each, we find that

s2 has probability 0

s3 has probability 3/14

s4 has probability 1/7

s5 has probability 9/14

Function format:


public static int[] calculate(int[][] m) {

// Your code goes here.



def answer(m):

Your program will be tested for custom inputs.

Készségek: Java, Matematika, Python

További információ: draw markov states matrix, matrix chain, markov chain creator, java markov chain generate text, markov chain text, java markov chain, markov chain text database, markov chain text processing, finding sponsor work united states, php markov chain, php markov chain example, markov chain text generation, markov chain text generator online, markov chain text generator, simple project marketing research, simple project management php script, simple project timekeeping program, possible simple project, simple project management script, flash simple project, markov chain generator, simple project flash, mysql php simple project, simple project jsp servlet, database php simple project

A munkaadóról:
( 0 értékelés ) Atlanta, United States

Projektazonosító: #11985708

20 szabadúszó tett, átlagosan $33 összegű árajánlatot erre a projektre.


I have completed my MS in Electrical Engineering and working in the field of designing for last 3 years. My projects have won more then 10 national level competitions. Area of Expertise -Discrete Time Signal Processing Bővebben

$100 USD 1 napon belül
(82 értékelés)

Easy project for me to finish it within a day

$20 USD 1 napon belül
(100 értékelés)
$45 USD 1 napon belül
(56 értékelés)

Feel fee to contact me [url removed, login to view] me message to discuss further more details .We provide the comments,images,videos,demos and live sessions in order to help the [url removed, login to view] payment only after the work done. You ca Bővebben

$40 USD 1 napon belül
(39 értékelés)
$60 USD 1 napon belül
(41 értékelés)
$50 USD 1 napon belül
(21 értékelés)

Hi, I am competitive to this kind of task, can take good care of this project. In fact, I already done related to this job before. Let me know the best of your time so we can discuss further based on your requirements Bővebben

$29 USD 0 napon belül
(9 értékelés)

Hello. More 20 years programming experience. I need more details to set real time and price. Regards. -------------------------------------------------------------------------------------------------------------- Bővebben

$40 USD 2 napon belül
(8 értékelés)
$25 USD 1 napon belül
(5 értékelés)

Could you provide any math paper that how to calculate probabilities? If not, i'll find them by myself. Will provide python code

$30 USD 0 napon belül
(2 értékelés)
$30 USD 1 napon belül
(4 értékelés)

Computer Science graduate and have experience in java Work on many projects of java So i will support you project as much you required. please check my profile i have done many project on java. hope will see you. Bővebben

$20 USD 1 napon belül
(4 értékelés)

Hello Sir, Raheel here. I've done too many projects in Java and Python having great knowledge about it. I assure you that I'll deliver your project on time and you can also visit my profile for surety. I hope you wi Bővebben

$25 USD 1 napon belül
(6 értékelés)
$30 USD 1 napon belül
(3 értékelés)

We are team of excellent developers and writers. We have 2 year experience related to your project field. We can do your project and solve your all problems according to your requirements. We have read your description Bővebben

$25 USD 1 napon belül
(2 értékelés)

I can write this for you. I like working with markov chains. I have revised this to 20 dollars Thank you

$25 USD 1 napon belül
(1 értékelés)

I have fair amount of experience in econometrics modeling in Python. I have implemented many macro-econometric models in python related to monetary economics and other financial data. I am comfortable in the usual pac Bővebben

$30 USD 1 napon belül
(3 értékelés)
$23 USD 6 napon belül
(1 értékelés)

Your program is ready Your program is ready Your program is ready The following is a test case ====================== int[][] m = new int[][]{{0, 1, 0, 0, 0, 1}, {4, 0, 0, 3, 2, 0}, {0, 0, 0, 0, Bővebben

$25 USD 1 napon belül
(0 értékelés)

We are the leading young professional software development organization having extensive technical expertise and knowledge in developing, managing, optimizing and customizing software’s both in Web and Desktop Applicat Bővebben

$25 USD 1 napon belül
(0 értékelés)