4
votes
2answers
82 views

QUICKSORT : how to resolve java.lang.StackOverflowError?

I am writing a quicksort program to run on an input size of 100000. I have tried running it at a size of 500 and it works fine but with million inputs, the program breaks with the following error code ...
3
votes
7answers
184 views

How to avoid stack overflow of a recursive function?

For example if we are traversaling a rather big tree by following function, it is possible that we get stack overflow. void inorder(node* n) { if(n == null) return; inorder(n->l); ...
10
votes
2answers
119 views

Why stack overflow exception is thrown on different call numbers?

Consider this code: private static int i = 0; static void Main(string[] args) { DoSomething(); Console.ReadLine(); } public static void DoSomething() { ...
2
votes
2answers
81 views

Find out how deep a call stack went in Clojure (or java)

Clojure is my first foray into the world of lisp. I decided to try a simple recursive function that raises a number to an integer power. Simple enough. (defmulti pow #(compare %2 0)) (defmethod pow 0 ...
-1
votes
2answers
64 views

Example of ++ error

Examples: Moderator please delete this thread since it serves no purpose. Thanks! This was just a subtly in the code that I missed. public boolean groupSum(int start, int[] nums, int target) { ...
1
vote
2answers
102 views

JSF: how prevent stackoverflow due to recursion during build phase (despite rendered test)

Apologies for not abstracting this problem in a dedicated test case, I hope the example from a real project is simple enough to describe the problem. I have a JavaEE/JPA2/JSF web application where ...
0
votes
1answer
110 views

Java Stackoverflow Error Recursion

This code I have written works great until a certain input size. If the input gets too large, I get a "java.lang.StackOverflowError". I have read some other entries on stackoverflow regarding this ...
0
votes
1answer
90 views

Stackoverflow with recursive function

let rec f a p n = if p n then a else a + f a p ( n - 1 ) let a, p, n = 3, ( fun x -> x = 1 ), 4 f a p n Getting stackoverflow when n <= 0. Not sure how to get around this.
1
vote
4answers
88 views

Java dealing with stackoverflow and continue normal execution after stackoverflow error

I'm trying to do a recursion in Java. I just want to stop the recursion and continue normal prgram execution void doit(){ try{ doit(); } catch (StackOverflowError e) { ...
3
votes
5answers
106 views

Stack overflow caused by recursive function

Being a beginner to C++ programming and computer systems architecture, I'm still learning the basics of C++. Yesterday I read about recursive function, so I decided to write my own, here's what I ...
-2
votes
4answers
130 views

Recursive function causing an overflow despite it's not infinite

The following function I wrote causing the program to crash due to the stack overflow, although the recursion is finite. public static void Key(char[] chars, int i, int l, string str) { string ...
1
vote
1answer
40 views

Can someone explain why I'm encountering stackoverflow?

I have a int, "count" that adds one after each recursion, but I also have an if statement that stops the recursion once the int is equal to, or greater than another integer. Somehow that if statement ...
0
votes
2answers
99 views

Why does this method cause an Infinite Recursive call?

I'm struggling to understand why this class is not functioning. It was part of an assignment for a course on Data Structures(EDIT: The deadline for the assignment has passed, I just want to figure it ...
1
vote
2answers
113 views

Stack Overflow Error in Java

I'm trying to code a program that finds the kth smallest element using recursion and quick sort like partitioning so as not to have to sort the entire array. I feel like my code should work, but I get ...
0
votes
2answers
62 views

recursion method Stack Overflow error

In my code i am just trying to make a simple program that tells you if one number can divide into another number evenly (in this case that number is 3). right now I am saying that if x (the number ...

1 2 3 4 5 9
15 30 50 per page