I hear people say a lot of times recursion can be an “endless loop”, but wouldn’t that saying be only applied to something done with loops. Would it be valid and correct to say “endless loop” for recursion like that? Wouldn’t it better to say “endless recursion”?
Can recursion have an endless loop?
630 Views Asked by wisemovi At
1
There are 1 best solutions below
Related Questions in RECURSION
- Needing a private and public method for the same recursive function
- Recursive function in PHP function : how to prevent return value?
- Json implicit format with recursive class definition
- java update all children in list
- recursively editing member variable: All instances have same value
- Editing pseudo_encrypt PostgreSQL function with Recurrsion to Avoid Certain IDs
- How to copy elements from array one to array two using recursion?
- create_progress_bar in recursive functions in R
- How to check that all values are equal in array using recursion?
- String List of filepaths to structured object
- FIFO Stock Valuation Through CTE-Recursion
- Recursion - nth element from last in a linkedlist
- Parsing user entered int into digits not working C++
- reverse a linked list using recursion error
- How to find Relationships between Objects
Related Questions in ITERATION
- Add key and value to dictionary
- For...Next loop breaks when using Not() operator
- Python - Nested Lists
- Process pairs of elements in a vector
- Understanding "ValueError: need more than 1 value to unpack" w/without enumerate()
- Iteration vs. Recursion for simple processing?
- Iteration over XML returns Same Node Over & Over
- Can I trust the order of a dict to remain the same each time it is iterated over?
- Perl: Iterating through large hash, runs out of memory
- Prolog-iterating through list
- Making Sub Lists Based on Lengths of Items
- How to solve T(n) = T(n-1) + n^2?
- Python: If key in dictA exist and key dictB do something
- Next element of array every iteration chat messages display php
- C - Simple Linked List program that handles strings
Related Questions in INFINITE-LOOP
- Isn't '\0' != 0 true?
- Displaying the ASCII characters in C without unsigned char
- Infinite loop in android background service, battery drain issues?
- Java infinite loop performance
- .htaccess - preventing infinite loops with URL rewriting
- How detect infinite loop in Java?
- Symfony / Silex maximum function nesting level
- Link Scraping Program Redundancy?
- How can you implement Delete and Search in a circular singly linked list?
- My While True loop is getting stuck in python
- Python Kivy: Add Background loop
- How to get access to form's controls from class C#
- How to get a call ended notification for a call which i have placed from my application - Android
- WordPress Custom Post Type Infinite Loop
- Is infinite loop still undefined behavior in C++ if it calls shared library?
Related Questions in INFINITE-RECURSION
- Infinite recursion (Stackoverflow) with JPA and Biderectional ManyToMany Relantionship
- How to capture and log infinite recursion errors in production PHP?
- Implementing N choose K recursively in Java
- C : Binary tree infinite recursion problem
- Best way of handling Jackson bi-directional references
- Can recursion have an endless loop?
- PHP recursive function not allowing page to load
- cannot run JSF 1.1 application in WebSphere Application Server 8.5.5
- Infinite JSON in ManyToMany relationship mapped by Intermediary Table
- C# 10.0 - How should I work around this particular "chicken and egg" problem involving two object that contain each other?
- StackOverflow error for maze solving program
- Typescript Type Flatten Child nested objects
- Infinite recursion in python code for factorial using a dict.get() method
- Unwanted recursion - how to avoid child click event from passing to parent in jquery?
- Why doesn't this fixed-point computation stop?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
A tail recursion can be considered a iterative loop. This is the only type of infinite recursion that doesn't swiftly end with a stack overflow error.
If you write this in a compliant ECMAScript 2016 implementation
It will hang forever and never cause a stack overflow. The browser will hang as it is a busy loop, but it will never get a stack overflow because tail calls are optimized into something like this:
If you consider the bottom one an infinite loop, the first one is not different. If this was C both would be turning into very similar assembly code using gotos, because assembly does not have while loops nor functions.