473,405 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

stack overhead on recursion

6
plz help, i have problem with my program
i'm using recursion to do flood fill algorithm
void flood (int x, int y, int fillcolor,int oldcolor) {
putixel(x+1,y,fillcolor);
putixel(x-1,y,fillcolor);
putixel(x,y+1,fillcolor);
putixel(x,y-1,fillcolor);
}
that recursion algorithm will fit with a small object but not with large object
it seems a stack problem and result illegal instruction
any suggestion to fix?
Apr 27 '07 #1
1 2259
JosAH
11,448 Expert 8TB
Read this link: http://en.wikipedia.org/wiki/Flood_fill

Basically it implements a floodfill but it doesn't use recursion for the east-west
direction but just applies a clever iterative approach (it searches for boundary
colours in the east-west direction).

kind regards,

Jos
Apr 27 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: herrcho | last post by:
int main() { printf("Input a line: "); wrt_it(); printf("\n\n"); return 0; } void wrt_it() {
48
by: Michael Sig Birkmose | last post by:
Hi everyone! Does anyone know, if it is possible to meassure the maximum stack usage of a C program throughout it's entire execution? -- Michael Birkmose
5
by: ip4ram | last post by:
I am quite puzzled by the stack overflow which I am encountering.Here is the pseudocode //define stack structure //function operating on stack void my_stack_function( function parameters) {...
2
by: jw | last post by:
what is the relation between a stack and recursion func. and if i have recursion funct(a return type void), void print(int n,int base){ static string digits="0123456789abcdef"; if(n>=base){...
13
by: deepak | last post by:
Hi In the following function how the memory 'll be allocated. 1) Will it allocate memory for all the char's together or allocate for first char. then for int then for float and after this only...
13
by: jm.suresh | last post by:
Hi, I have a program which literately finds the object that overlapping a point. The horizontal and vertical search are called recursively from inside each other. Is this way of implementation...
11
by: Nehil | last post by:
I would like to know which is dynamic in nature. if i refer the C memory model (Richard Steven), it is shown that both stack and heap grow towards each other. Now, can one go into other's area and...
4
by: lianne.ribeiro | last post by:
I am using Visual C++ 6 IDE,with 512MB RAM. I have coded a recursive function that has a correct end condition for recursion. There is no infinite recursion. For some input data,the recursive...
62
by: jt | last post by:
hello everyone.. int fun() { /* anything */ } int main(void) { fun(); }
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.