Assuming an algorithm requires an array of 1080 bytes of RAM(maybe not realistic, but theoretically the algorithm work). For languages like Python, [0]*(10**80) just theoretically work (ignoring optimizing here), but for C, currently there's only 64-bit machine, and avaliable RAM far not enough.

What is the default when such happens? (inf-bit machine or what)

  • 1
    \$\begingroup\$ Why would the algorithm require that much memory? Is it parametrized? (for example is it 10ⁿ where n is the input) \$\endgroup\$
    Commented Jun 14, 2018 at 12:07
  • \$\begingroup\$ @user202729 maybe. Lots of code-golf use more time and space for shorter code, so large cost usually happen \$\endgroup\$
    – l4m2
    Commented Jun 14, 2018 at 12:14
  • \$\begingroup\$ Partial asnwer: Allowing python to do something like [0]*(10**80) isn't really that different than allowing lenguage/unary to compete, so I don't think there's any problem with that as long as it can be proven to be correct. However, since C can only address a finite amount of space, no hypothetical computer could ever run a C program that addresses more, so that shouldn't be valid. \$\endgroup\$
    – DJMcMayhem
    Commented Jun 14, 2018 at 14:22
  • \$\begingroup\$ Python (specifically CPython) is subject to the same memory constraints as C, and the same solution works for both: virtual memory and paging. \$\endgroup\$
    – user45941
    Commented Jun 15, 2018 at 0:28
  • \$\begingroup\$ @DJMcMayhem It can address more memory, using an arch where sizeof(size_t) * CHAR_BIT is larger. Still finite, however. \$\endgroup\$
    Commented Jun 15, 2018 at 6:06


You must log in to answer this question.

Browse other questions tagged .