Questions tagged [infinite-recursion]

An infinite recursion occurs when one or several recursive methods keep on calling each other and never reaching a terminal case. Such a situation will most likely end up in the call stack to overflow.

An infinite recursion occurs when one or several recursive methods keep on calling each other and never reaching a terminal case. Such a situation will most likely end up in the call stack to overflow.

64 questions
0
votes
0 answers

Using a variable outside its function

I want to use the checkedCount variable inside of the generatePassword function in order to not call the function matrixEffect at the end of generatePassword if the value of checkedCount is 0. I used the argument checkedCountValue to be able to use…
0
votes
0 answers

How do I avoid infinite recursion when checking if a chess move is legal?

I am creating a chess game in Python for a school project, but don't know how to check if a move is legal without causing a stack overflow. My algorithm works by making the move Checking if the king is now in check (by seeing if the king's position…
Freddie
  • 1
  • 2
0
votes
1 answer

Given an adress, how can I access the object in Python?

How can I access a Python object by it's address that I get from id(self.__dict__)? The background is the following, I want to access one class instance from the other (both classes mimic custom dictionaries): class1: def __init__(self): …
foobar
  • 23
  • 5
0
votes
1 answer

Typescript Type Flatten Child nested objects

i have been following this example and here to flatten a type invain. Most of this flatten the object completely into removing the nests. I would like to to maintain my structure, just removing some wrappers (in this case body) in the nested…
0
votes
2 answers

Getting infinite recursion with ObjectMapper even though entities' fields are annotated with @JsonIgnore

Got two entities: class Entity1{ @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "entity1Id", unique = true, nullable = false) private Integer entity1Id; @OneToMany(mappedBy = "entity1",…
Marco
  • 322
  • 1
  • 3
  • 15
0
votes
1 answer

Python Recursion not exiting the function, Find the last index of 'x' in the 'arr' recursively

Read input as specified in the question Print output as specified in the question. arr=[34, 57, 82, 41, 65, 35, 82, 27, 36, 12, 6, 40, 66, 99, 25, 29, 22, 25, 12, 24, 65, 15, 5, 43, 28, 33, 76, 32, 13, 95, 22, 84, 71, 23, 28, 7, 65, 94, 18, 47, 9,…
0
votes
0 answers

C : Binary tree infinite recursion problem

I can't seem to find where the problem is in my code, i'm essentially storing character patterns, if an existing pattern is already present I'll store it in the duplicate node, otherwise it will shift to the regular pattern one. The problem starts…
0
votes
1 answer

How to execute AST or code object in a separate process without exceeding max recursion depth

I am trying to write a metamorphic quine. Without the "spawn" context, the subprocesses seem to inherit the stack, and so I ultimately exceed the max recursion depth. With the "spawn context," the subprocess doesn't seem to recurse. How would I go…
0
votes
3 answers

Not sure why I'm stuck in a Python stuck recursion loop

The add and mul definitions here are nonsensical because of their dependence on returning self, causing infinite loops. If they create a new distribution using the lambdas then it works fine, as in my own answer below. I'm just playing around with…
Milan
  • 344
  • 1
  • 10
0
votes
0 answers

Stack Overflow Exception in Recursive Program Due to Missing Check

I am battling with this puzzle where I have a small, recursive program that is sort of similar to Conway's life. It has a set of octopuses arranged in a 10x10 grid, and each one has an energy level from 0 to 9. During each step of solving this…
ProfK
  • 49,207
  • 121
  • 399
  • 775
0
votes
0 answers

R markdown knitting error (infinite recursion)

I am trying to knit an R markdown document into pdf, but it keeps failing and shows this message only: Error: evaluation nested too deeply: infinite recursion / options(expressions=)? Execution halted It has nothing to do with my codes, because R is…
0
votes
1 answer

What is the best way to build own system metric collector agent

Myself have an idea to build own metric collection agent for linux systems with various customised features and controls. Would like to know what is the best practice to collect metrics continuous from a linux system. Is it best to use infinite…
0
votes
0 answers

Why a recursion error occurs when implementing the Karachuba algorithm in python

Karachuba algorithm : https://en.wikipedia.org/wiki/Karatsuba_algorithm threshold = 4 def prod2(a, b): n = max(len(str(a)), len(str(b))) if a == 0 or b == 0: return elif n <= threshold: return a*b else: m =…
user9178840
0
votes
0 answers

Infinite recursion of class at initialization

I've been working on a side project in Java in order to become more familiar with threads. It's a cookie clicker clone that uses different threads for the clicker, the counter, and everything else. Upon trying to run the final build I get an…
0
votes
0 answers

lazy computing of primes with python without recursion error

I came across this great video from computerphile which talked about lazy computing. In the video, they lay out this really beautiful bit of python code that will calculate primes using the sieve method "lazily" def nats(n): yield n yield…
lstbl
  • 527
  • 5
  • 17