I want to know the difference between a recursive function and use the stack in terms of memory usage. Say for large DFS , which will be more efficient.
The explicit data structure of the stack should theoretically use a little less memory, since a recursive function will always have additional overhead for each call, for the return address, etc.
, . G = (V, E), V - , E - , (DFS) :
visit
, , , O (d), d - DFS ( .
, . , call-stack , . , , . , . , , , . .
, , . , , , . , - , , - .
This view is supported by “Garbage collection is fast, but the stack is faster,” James S. Miller and Guillermo Rozaz: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.18.2789
Source: https://habr.com/ru/post/1795270/More articles:hierarchical cut - solrUsing a ticket server to generate primary identifiers? - javaSending CTRL-S message to window - c #https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1795268/strange-behaviour-on-safari-on-ios-too-complicated-to-explain-here&usg=ALkJrhiPkSpVwc9kCDtRTOZkuR81D_cmIwTypical erlang web / enterprise application architecture? - erlangJava encryption - javaHow to write * / in javadoc - javaNeed a "SOAP client with WSSE authentication" ... is Visual Studio suitable for this? - authenticationDoes Cast вызывает IQueryable для оценки в Linq-to-SQL? Каковы ограничения на его использование? - castingNHibernate Cascade Deletes - c #All Articles