Re: [algogeeks] Recursion and Rooted Binary Trees

2012-05-02 Thread Rose
Dear guys, I have looked closer, I have written this, will you please see if the 3 algorithms make any sense, especially 4.3 - and please help with the running time? Thanks in advance. I need to hand in tonight before midnight. Thx 4.1 *a. * N P

Re: [algogeeks] Recursion and Rooted Binary Trees

2012-05-02 Thread mohit mishra
just check first for the right child of node if (right*[**x**]** ≠* NIL ) and then first call print method for right child Algorithm 3 Print(x) 1: if (*x **≠* NIL) then 2: print *colour **[**x**]* 3: if (right*[**x**]** ≠* NIL) then 4: Print (right*[**x**]**)* 5:

Re: [algogeeks] Recursion and Rooted Binary Trees

2012-05-01 Thread atul anand
assignment is not at all tough , i guess you should understand recursion to solve these question. for eg : in question 4.1 : you just need to swap line number 4 and line number 5 to get the solution. in question 4.2 , you are given code for counting total number of nodes in the tree and for counti

Re: [algogeeks] recursion

2011-10-01 Thread rahul sharma
supose i have an array in recursion which is initialized with value n... in every recusrsive call i decrement n so that mean if initially array initialized with 10 but in second recursive call it will be 9 n when i print it will print with 10 initialized value n with 9 alosi thnk so...what

Re: [algogeeks] recursion

2011-10-01 Thread Hatta
wait wait, that depends on the scope, the language, eventually the compiler, everything. please show a snip of recursive code so we can tell, please? On Sat, Oct 1, 2011 at 3:44 PM, rahul sharma wrote: > as we know in recursion new set of variables are created for every > recurrsive call...if i

Re: [algogeeks] recursion

2011-10-01 Thread shady
arrays are passed by reference, but variables are created each time On Sun, Oct 2, 2011 at 12:14 AM, rahul sharma wrote: > as we know in recursion new set of variables are created for every > recurrsive call...if i have array in recursion,then does a new array created > for every recursive call??

[algogeeks] recursion

2011-10-01 Thread rahul sharma
as we know in recursion new set of variables are created for every recurrsive call...if i have array in recursion,then does a new array created for every recursive call??? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group,

Re: [algogeeks] recursion

2011-08-31 Thread rajeev bharshetty
Non Recursive calls store the local variables and stuff in stack whereas in recursive calls the return addresses and the local variables for each call are stored as stack frames with frame pointers and stack pointers. On Thursday, September 1, 2011, teja bala wrote: > @priya > stack is a non rec

Re: [algogeeks] recursion

2011-08-31 Thread teja bala
@priya stack is a non recursive version of a recursion. eg:- fac(int x) { f1( )//non recursive call ~= recursive indirectly { if(x>0) { fac(x--);//recursive call } } } -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks"

[algogeeks] recursion

2011-08-31 Thread priya ramesh
Is there any difference between a non recursive call and a recursive call in C?? I'm asking about parameter passing and differences in the stack allocation for non recursive call and a recursive call?? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks"

Re: [algogeeks] recursion help!!!

2011-08-07 Thread sukran dhawan
trace recursive routines for fibbonacci series , tree traversal ,gcd routines .google it for the code. On Sun, Aug 7, 2011 at 8:10 PM, Nikhil Veliath wrote: > hey can ya give me some recursive codes wid a little > explanationthnx in advance! > > On Sun, Aug 7, 2011 at 8:05 PM, sukran dhawan

Re: [algogeeks] recursion help!!!

2011-08-07 Thread Nikhil Veliath
hey can ya give me some recursive codes wid a little explanationthnx in advance! On Sun, Aug 7, 2011 at 8:05 PM, sukran dhawan wrote: > write simple recursive routines and trace them for each program... using a > stack by popping and pushing.do it for some 10 programs.u will automatically > a

[algogeeks] recursion nearest square

2011-08-07 Thread Nikhil Veliath
write a recursive code to print the nearest square of a number eg if no is 27 the nearest square is 5 it should also take care of large nos... -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to alg

Re: [algogeeks] recursion help!!!

2011-08-07 Thread sukran dhawan
write simple recursive routines and trace them for each program... using a stack by popping and pushing.do it for some 10 programs.u will automatically appreciate the power of recursion and learn it :) On Sun, Aug 7, 2011 at 8:03 PM, Nikhil Veliath wrote: > i am having problems in writing code u

[algogeeks] recursion help!!!

2011-08-07 Thread Nikhil Veliath
i am having problems in writing code using recursion.any help !!...any links? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

[algogeeks] Recursion Help

2011-08-07 Thread Nikhil Veliath
i am having problems in writing code using recursion.any help !!...any links? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] recursion ???

2011-07-24 Thread sanjay ahuja
+ which follows 0 is due to null character at the end of the string and it will not be printed on the console." - " which follows " + " is due to same reason. The null character is returning condition from the recursion, after that each character of string preceded by "-" is printed on the screen

[algogeeks] recursion ???

2011-07-24 Thread nullpointer
#include #include void printit(char line_of_char[], int index); int main() { char line_of_char[80]; int index = -1; strcpy(line_of_char, "1234567890"); printit(line_of_char, index); return 0; } void printit(char line_of_char[], int index) { if(line_of_char[index]) { index++; printf("+%c"

[algogeeks] recursion

2011-04-15 Thread priya mehta
http://www.ideone.com/PmJ7A -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more optio

Re: [algogeeks] recursion to remove duplicate characters in a string

2010-09-21 Thread sharad kumar
instead of creating a bst why dontwe create a heap.then sort the heap .then remove the duplictes from string...but will also chnge th order of string. On Sun, Sep 19, 2010 at 4:20 PM, Umer Farooq wrote: > creating a bst would require extra space. You can do this with an array of > char dude.

Re: [algogeeks] recursion to remove duplicate characters in a string

2010-09-20 Thread LG JAYARAM .
Yes ur correct...it will require some extra spacebst can be represented in the array form ritelet me think in tht logic. On 9/19/10, Umer Farooq wrote: > > creating a bst would require extra space. You can do this with an array of > char dude. > > On Sun, Sep 19, 2010 at 3:31 PM, LG JAYA

Re: [algogeeks] recursion to remove duplicate characters in a string

2010-09-19 Thread Umer Farooq
creating a bst would require extra space. You can do this with an array of char dude. On Sun, Sep 19, 2010 at 3:31 PM, LG JAYARAM . wrote: > hi buddy ...Im clear with the ideahereby I share the concept... > > wat exactly need to be done to solve this task isbetter create a Binary > searc

Re: [algogeeks] recursion to remove duplicate characters in a string

2010-09-19 Thread LG JAYARAM .
hi buddy ...Im clear with the ideahereby I share the concept... wat exactly need to be done to solve this task isbetter create a Binary search tree...the Binary search tree will not allow duplicates and If u perform a inorder traversalu can get the result...the task is oversimple a

Re: [algogeeks] recursion to remove duplicate characters in a string

2010-09-18 Thread Ashish Goel
the interviewer would be stupid to ask this question!!! Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Sat, Sep 18, 2010 at 11:12 PM, jagadish wrote: > You are given a string which is sorted.. Write a recursive function to > remove the dupl

Re: [algogeeks] recursion to remove duplicate characters in a string

2010-09-18 Thread Umer Farooq
btw, if u rn't suppose to use any extra space, then u should be going for iterative solution; since recursion uses extra space by default. On Sat, Sep 18, 2010 at 11:33 PM, Umer Farooq wrote: > here's the java implementation > > package removeduplicates; > import java.io.*; > /** > * > * @auth

Re: [algogeeks] recursion to remove duplicate characters in a string

2010-09-18 Thread Umer Farooq
here's the java implementation package removeduplicates; import java.io.*; /** * * @author UmerFarooq */ public class Main { /** * @param args the command line arguments */ public static char[] input; public static void remDep(int i, int j) { if (j<0)

[algogeeks] recursion to remove duplicate characters in a string

2010-09-18 Thread jagadish
You are given a string which is sorted.. Write a recursive function to remove the duplicate characters in the string. eg: potatoeos output: potaes NO extraspace like hash/ bitmaps.. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to t

Re: [algogeeks] Recursion!!!!!!!!!!! Always Stuck

2010-09-15 Thread TurksHead Education
Recursion: http://www.rawkam.com/?p=283 Tower Of Hanoi: http://www.rawkam.com/?p=917 http://www.rawkam.com/?p=941 On Fri, Sep 10, 2010 at 1:11 AM, albert theboss wrote: > Its easy only

Re: [algogeeks] Recursion!!!!!!!!!!! Always Stuck

2010-09-09 Thread albert theboss
Its easy only tower of hanoi consist of three pegs peg A,peg B,peg C. which is used as BEG,AUX,END Let n be 5 for example... wat u r going to do is step 1 : move the top n-1 (4) disks from BEG to AUX... in this case END will be used as auxiliary. step 2: move the n th disk

[algogeeks] Recursion!!!!!!!!!!! Always Stuck

2010-09-09 Thread bittu
Can Anyone explain me how recursion works in C. i will be thankfull if he/she will use an example of towerofhanoi .??? Regards Shashank -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge..

Re: [algogeeks] Recursion Space in Merge and Quick Sort

2010-06-28 Thread UMESH KUMAR
Space required for MERGE SORT is* O(logn)* Because the based on Dived And Conquer every level dived size of n/2 So height of the tree is *logn* .And each level take cost O(n) Recrsn Eqn: T(n) =O(1) if n=1. T(n) =2T(n/2) +Cn otherwise Total cost=O(nlogn) in which cost of merge procedure =O(n

[algogeeks] Recursion Space in Merge and Quick Sort

2010-06-28 Thread amit
I have read that-> Space required for recursion in Merge Sort in O(logn) But Space required for recursion in Quick Sort in O(n)( Worst Case ) Can anybody expain how is recursion space calculated as both Quick and Merge Sort make to recursive calls... -- You received this message because you are

Re: [algogeeks] Recursion help!

2010-06-05 Thread Anand
This a good example of dynamic programming. On Fri, Jun 4, 2010 at 10:15 AM, satwik krishna wrote: > i think the best way to trace is to draw a picture of the stack and put the > values and acc understand the flow > > > On Fri, Jun 4, 2010 at 7:22 AM, Prashant Kulkarni < > prashant.r.k...@gmai

Re: [algogeeks] Recursion help!

2010-06-04 Thread satwik krishna
i think the best way to trace is to draw a picture of the stack and put the values and acc understand the flow On Fri, Jun 4, 2010 at 7:22 AM, Prashant Kulkarni wrote: > > int Max(int a[],int n) > { >int max; >if(n==1) ---( 1 >

Re: [algogeeks] Recursion help!

2010-06-04 Thread b. roffmann
loop recurs "with array index n,n-1,..,0" as stated in this thread. will return Max value from array, for (n-1) upon each integer of iteration n, upon condition present element is larger than previous element, otherwise, it will return the previous value. the algorithm seems to provide a seri

Re: [algogeeks] Recursion help!

2010-06-04 Thread Raj N
@Prashant: Are you saying that after the base case has been reached, only then statements 3,4 will be executed for all the recursive calls? On Fri, Jun 4, 2010 at 7:52 PM, Prashant Kulkarni wrote: > > int Max(int a[],int n) > { >int max; >if(n==1)

Re: [algogeeks] Recursion help!

2010-06-04 Thread Prashant Kulkarni
int Max(int a[],int n) { int max; if(n==1) ---( 1 ) return a[0]; else max=Max(a,n-1); ---( 2 ) if(max>a[n-1]) return max;

[algogeeks] Recursion help!

2010-06-04 Thread Raj N
int Max(int a[],int n) { int max; if(n==1) return a[0]; else max=Max(a,n-1); if(max>a[n-1]) return max; else return a[n-1]; } Hi, the above is a code to find the max in an array recursively. I f

[algogeeks] recursion issue

2006-02-07 Thread sam
Hi, Not sure I'm on the right forum for that, but here we go. I have a problem writing an algorithm for doing what I want. I have two simple SQL table that I need to show you in order to explain my problem: [Query] (QueryId, QueryName) [QueryLink] (QueryLinkId, QueryId, LinkedQueryId) Nothing sp

[algogeeks] recursion question

2006-02-06 Thread H.
When writing a string backwards recursively, there are at least two ways to do it: in pseudocode: void writeBackward1 ( string s): if s is empty do nothing if s isn't empty output last character of s writeBackward1 ( s minus last character) void writeBackward2 (string s):

[algogeeks] Recursion in blobs

2006-01-25 Thread H.
Today in a data structures class we went over blob recursion. What we went over is actually described on this page (different school though): http://www.bowdoin.edu/~ltoma/teaching/cs107/fall05/Labs/lab9.html I understand how the recursion works, but I'm more interested in determing the exact alg