Ad
  • Default User Avatar
  • Default User Avatar

    It's a difficult question. What you need to learn depends on challenges you will face during the trial, your background in computer science, and programming skills. I don't know anything about that.

    It would be fine to address this question to the supervisor/manager/administrator/etc. of your preliminary trial. If it isn't possible, you may read any short guide about the C language, data structures and algorithms, for example: http://www.cs.yale.edu/homes/aspnes/classes/223/notes.html, chapters 4, 5, may be 3 (if you use Linux).

    But again, it's very difficult to give an advice without any knowledge about the trial, your background and skills.

  • Default User Avatar

    Hi,

    Your description of the solution is correct.

    Feel free to ask any questions, and good luck with learning the C language.

  • Default User Avatar

    Yes, I've added one new test case (medved test) only. It's the only difference.

    And I've changed my own solution, of course.

    Thanks!

  • Default User Avatar

    The description of this kata doesn't specify the function call precedence. On the other hand, there aren't tests that depend on it. All tests can be successfully passed in both cases.

    So, you can choose any of these options (or implement two versions of the interpreter :) )

  • Default User Avatar

    C translation has been published.

    Could anyone review and approve it, please?

  • Default User Avatar

    C translation has been published.

    Could anyone review and approve it, please?

  • Default User Avatar

    Please, correct me if i'm wrong: the C random tests always use the first test case only.

    In the cpp random tests i made it test all 7 test cases.

    Hope it's al'right.

    These 7 test cases have different levels of complexity so a time consumption of different tests varies widely (depends on an algorithm).

    In C translation is used only one test case as the basis of random tests to obtain a more stable total time consumption. This is important for 10 random tests.

    Of course, for a large number of tests, the total time consumption doesn't depend on the level of complexity of individual tests.

  • Default User Avatar

    Thank you very much.

  • Default User Avatar

    I've published update (7 + 10).

  • Default User Avatar

    Some results:

    1. 7 fixed tests + 3 random tests: ~450 ms

    2. 7 fixed tests + 10 random tests: ~780 ms

    3. 7 fixed tests + 20 random tests: ~1100 ms

    All random tests are based on one fixed test ("medium").

    I propose to choose the option '7 fixed tests + 10 random tests' with random tests are based on one fixed test.

    PS

    For my solution there isn't significant difference between the difficulty of fixed tests:

    1. the simplest fixed test: ~32-35 ms

    2. the hardest fixed test: ~62-65 ms

    3. the average result: ~45 ms

    Therefore, the difference between the random tests based on one fixed tests and the random tests based on all available fixed tests isn't great.

  • Default User Avatar

    So if your soluiton handle 200 random tests in addition, it's almost 20 times too much performant as a reference. ;)

    Are you surprised that C language is faster than JS? :)

  • Default User Avatar

    I'm sorry, I can't figure out what those numbers mean. I'm not very sharp today; please just answer the question I'm asking, as concise as possible. (Humour me! Not enough sleep .. :)

    Did you check solutions from the 6×6 kata against this? How many passed, how many timed out?

    I'm sorry if I misunderstood your question.

    The 6x6 kata (C translation) has 4 fixed tests and 32 random tests.

    There are 3 solutions:

    1. my solution takes ~150 ms to pass all tests.

    2. asm-jaime's solution takes ~800 ms to pass all tests.

    3. zwyx's solution takes more 5 - 7 secons to pass all tests. Sometimes it exceeds the time limit.

    I'm sorry, I can't figure out what those numbers mean.

    The results for the 6x6 kata:

    a) ~0.8 sec for 200 random tests

    b) 2900 - 3100 passed tests for time out.

    If we set 200 random tests (and 4 fixed tests) for the 6x6 kata, then my solution will take ~0.8 second to pass all of them.

    If we set ~2900 - 3100 random tests (and 4 fixed tests) for the 6x6 kata, then my solution will fail these tests by time out.

    OK, there are 3 solutions from the 6×6. If I want one of them to pass this kata, and two of them to time out, how many random tests should we set?

    I tried to test solutions from the 6x6 kata for the 7x7 case:

    1. zwyx's solution:

    a) fixed test #0 ("medium"): ~500 ms;

    b) fixed test #1 ("hard"): ~2200 ms;

    c) fixed test #2 ("hard"): time out;

    d) fixed test #3 ("very hard"): ~5300 ms;

    e) fixed test #4 ("very hard"): time out;

    f) fixed test #5 ("very hard"): ~6000 ms;

    g) fixed test #6 ("very hard"): time out;

    It is an inefficient solution or there is a bug.

    1. asm-jaime's solution requires significant modifications to be used in the 7x7 case.

    2. my solution: if we set 100 random tests, it takes ~5 seconds to pass all tests (fixed and random).

    And the question I forgot to ask: how long does your solution for the 7×7 need for the tests of the 6×6?

    My solutions for the 6x6 and the 7x7 are the same (except one line). See performance data above.

    Note: I'm assuming the fixed tests for the 7×7 C are the same as the fixed tests in JS, and the random tests are also the same tests as the random tests, but repeated. Keep it as comparable as possible.

    The random tests are actually not as hard as the fixed tests (for my solution). Some fixed tests take 3000 ms I think; the random tests (there are only 3) take approx 200 ms each.

    My translation uses all available fixed tests as the basis for the random tests. Python solution uses one fixed test as the basis for the random tests (I can't see the original JS solution).

    If you would like the translation to be as comparable as possible to the original, I will use one fixed test ("medium") as the basis for the random tests.

    I suggest to set 50 random tests. My solution takes ~2.5 seconds to pass 7 fixed tests and 50 random tests. In this case other people will have enough opportunities to pass these tests and to train their optimization skills.

  • Default User Avatar

    You didn't understand what Johan explained in the description: the base >solution need 10s to solve ONLY the tests that were originaly provided by >him (so less than 10 tests). Your translation is WAAAAAAY harder than >requiered!

    As I understood, the reference solution performs all tests in less than 10 seconds. My solution satisfies this condition (for C language case).

  • Default User Avatar

    There are 3 solutions for 6x6 kata (C language):

    1. zwyx's solution: 50 - 60 passed tests for time out
    2. asm-jaime's solution: 500 - 600 passed tests for time out
    3. my solution: 2900 - 3100 passed tests for time out :)
  • Loading more items...