1
vote
0answers
115 views

Infinite Loop Haskell [closed]

I'm trying to write a function that given a world, it iterates it as many times as specified then returns the new world. But when I run the function, it will iterate once, and then throw a ...
0
votes
2answers
34 views

SIGXCPU error in C program

The following program is not producing output. It enters the for loop and takes one value (via scanf) but after that the code block stops execution. Ideone (an online compiler and debugging tool) ...
3
votes
3answers
84 views

Why is this function in an infinite loop - learning lisp

(EDIT: I'm not going to worry about TCO yet) I'm (finally getting around to) learning Lisp. I'm trying to write my own (naive-ish) function to flatten a list. I'm starting with the simpler cases and ...
-6
votes
1answer
81 views

How to calculate the cost of algorithm has infinite loop [closed]

my algorithm has an intentional looping the program repeat itself each time by recursive calling so how can I explain the cost (cost analysis) of it ?
0
votes
8answers
219 views

Java : Recursion -While Loop Vs If Loop

Code Design 1 : works perfectly public static void main (String[] args) { recursion(2); } public static void recursion(int num) { if (num > 0) ...
0
votes
7answers
367 views

Java - execute method only once

I have a simple problem: Class A{ B b; public void doSth{ //This method should execute only once b.modify(); //calls doSth() again... } } As the program runs, an ...
1
vote
2answers
114 views

F# replacing variables with actual values results in endless loop (recursive function)

I recently started with F# and implemented a very basic recursive function that represents the Sieve of Eratosthenes. I came up with the following, working code: static member internal ...
0
votes
1answer
208 views

Java - infinite recursive for loop

I am trying to calculate the number of combinations of sequences (ArrayList) that can be stacked, but each row cannot contain any of the elements that are contained in adjacent rows up to a specified ...
0
votes
1answer
323 views

Javascript window tree recursion and infinite objects

I'm trying to write a function that will dump a recursive tree of window for all browsers. A problem that I immediately realized I was going to have, had to do with infinite objects ...
2
votes
4answers
206 views

Why do circular references and recursion make my program fail?

I wrote this simple Prolog program. man(socrates). mortal(X) :- man(X). immortal(X) :- immortal(X). I asked it the usual questions, such as whether Socrates is a man or if Socrates is a mortal. ?- ...
7
votes
6answers
326 views

Is it a sin to use infinite recursion for infinite loops in Python?

This question is more about curiosity than utility. If I'm writing a function that's supposed to run for ever, for instance a daemon, how would Python handle it if I called the function again from the ...
-3
votes
4answers
190 views

Recursive method will not move on and remains in an infinite loop (Java )

I'm learning about recursion as part of a Java tutorial and I am looking for a little help. We need to make a recursive Java program which will work out how to get from one city to the other when ...
2
votes
4answers
646 views

When will infinite loops, and recursive functions with no stop conditions, eventually stop?

I heard a myth saying that infinite loop or a recursive function with no stop condition will stop when "the stack overflows". Is it right? For example : void call() { call(); } or for(;;){;} ...
1
vote
1answer
281 views

Better GDB Usability for Call Stack Overflows

Can GDB detect call stack overflows typically in infinite recursion bugs and print some nice error and context message instead of the code given below which is very hard to understand for novices and ...
0
votes
2answers
292 views

Infinite loop in simulation

I'm starting out in python.. The details I have written in the below.. It goes to an infinite loop and give me an error when I try to call the function inside itself.. Is this kind of recursion not ...

1 2
15 30 50 per page