S
S
Snewer2016-06-02 00:30:30
Algorithms
Snewer, 2016-06-02 00:30:30

How to write a RAM machine?

Hello!
I just can't figure out how to solve the problem on a RAM machine: "The input is a sequence of numbers. Output the largest numbers." How to implement it?
Thank you!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey, 2016-06-02
@Snewer

First, why "greatest numbers" and not "greatest numbers"?
Second, what have you already tried and what didn't work?
Regardless of the programming environment, the search for the maximum value consists in comparing the next value with the value in memory, if the current one is greater than the memorized one, we remember the current one.
If you post a sketch of the program and a link where you can run it - I'll help.

A
Alexey Skobkin, 2015-09-14
@skobkin

The question is too general.
You can use both curl and file_get_contents() .
You can deserialize the API response with json_decode() .
And the parts are sorted by a function to sort the elements in an array like sort() or ksort() .

T
Talgat Baltasov, 2015-09-14
@talgatbaltasov

since javascript was indicated in the tag, I’ll tell you how to do it through ajax.
$.ajax({
url:" https://getbible.net/json?p=James3:1 ",
success:function(data) {
here you process the message (it's an incomprehensible format, you need to adjust it to json)
}
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question