Re: [algogeeks] why only static and global variables have default initial value 0.....why not automatic variables have???

2011-09-29 Thread prasanth n
may be bcoz they(auto) are stored in stack On Thu, Sep 29, 2011 at 10:05 PM, tech rascal techrascal...@gmail.comwrote: -- 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

Re: [algogeeks] Linked List Problem

2011-09-29 Thread prasanth n
consider the length of list1 is 7(ie m) and length of list2 is 5 (ie n)..now find (m-n) ie 7-5=2..since length of list2 is smaller than list1,,have a pointer pointing to the head of the list2 and move that pointer (m-n) positions ie (here 2 positions)..now have a pointer pointing to the head of

Re: [algogeeks] Searching Problems !!

2011-09-25 Thread prasanth n
@ Decipher: Q1) find where the rotation begins and do binary search in the first half or the second half depending upon the search element On Sun, Sep 25, 2011 at 8:58 PM, Decipher ankurseth...@gmail.com wrote: Q1) A sorted array is rotated unknown number of times , write an algorithm to

[algogeeks] BST

2011-09-21 Thread prasanth n
Given a binary search tree, design an algorithm which creates a linked list of all the nodes at each depth (i.e., if you have a tree with depth D, you’ll have D linked lists). -- *prasanth* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

[algogeeks] tree to list

2011-09-21 Thread prasanth n
anyone give an algorithm of how to convert a binary search tree into a linkedlist -- *prasanth* -- 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,

Re: [algogeeks] tree to list

2011-09-21 Thread prasanth n
@sukran: must do it in place.. On Wed, Sep 21, 2011 at 7:01 PM, sukran dhawan sukrandha...@gmail.comwrote: do BFS search,at each level make a linked list On Wed, Sep 21, 2011 at 6:50 PM, prasanth n nprasnt...@gmail.com wrote: anyone give an algorithm of how to convert a binary search tree

[algogeeks] question

2011-09-21 Thread prasanth n
You have given a positive number you have to find a number which is bigger than that by using same digits available in the number . Example :- You have given a number 7585 , your output should be 7855 . -- *prasanth* -- You received this message because you are subscribed to the Google Groups

[algogeeks] stack

2011-09-20 Thread prasanth n
In the classic problem of the Towers of Hanoi, you have 3 rods and N disks of different sizes which can slide onto any tower. The puzzle starts with disks sorted in ascending order of size from top to bottom (e.g., each disk sits on top of an even larger one). You have the following constraints:

Re: [algogeeks] Re: stack

2011-09-20 Thread prasanth n
@don: yes it think On Tue, Sep 20, 2011 at 11:00 PM, Don dondod...@gmail.com wrote: Does the call stack count as a stack? Don On Sep 20, 12:27 pm, prasanth n nprasnt...@gmail.com wrote: In the classic problem of the Towers of Hanoi, you have 3 rods and N disks of different sizes which

Re: [algogeeks] Re: stack

2011-09-20 Thread prasanth n
{ move(n-1, from, use, to); move(1, from , to, use); move(n-1, use, to, from); } } int main(int argc, char* argv[]) { const int n = 5; move(n, 1, 2, 3); return 0; } On Sep 20, 12:37 pm, prasanth n nprasnt...@gmail.com wrote: @don

[algogeeks] tree

2011-09-20 Thread prasanth n
You are given a binary tree in which each node contains a value. Design an algorithm to print all paths which sum up to that value. Note that it can be any path in the tree - it does not have to start at the root. -- *prasanth* -- You received this message because you are subscribed to the

[algogeeks] random function

2011-09-19 Thread prasanth n
anyone give an algorithm of how to generate a random number..probability of occurrence of each no should be the same.. -- *prasanth* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] C++ Query

2011-09-19 Thread prasanth n
@teja: if we use call by value in copy constructor,, class base { int a; public: base(int x) { a=x; } base(base c) { } }; int main() { base b(1); base b1=b;// this ll be seen as base c=b(see the copy constructor)..this ll in turn call another copy constructor.. return 0; } now it ll create

Re: [algogeeks] All valid dictionary words must be found and printed.

2011-09-19 Thread prasanth n
@don: can u give the algorithm?? On Mon, Sep 19, 2011 at 10:37 PM, praveen raj praveen0...@gmail.com wrote: Use trie. On 19-Sep-2011 8:20 PM, Sangeeta sangeeta15...@gmail.com wrote: given an array of characters without spaces and a dictionary.All valid dictionary words must be found and

[algogeeks] binary tree

2011-09-18 Thread prasanth n
You are given a binary tree in which each node contains a value. Design an ALGORITHM to print all paths which sum up to that value. Note that it can be any path in the tree - it does not have to start at the root. -- *prasanth* -- You received this message because you are subscribed to the

[algogeeks] matrix

2011-09-17 Thread prasanth n
given a matrix with +ve and -ve numbers, find the submatrix with maximum sum?? -- *prasanth* -- 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,

Re: [algogeeks] matrix

2011-09-17 Thread prasanth n
abt the subarray element instead it tells abt max sum of subarray . to get the element of subarray store the end_offset whenever your max_sum changes . On Sat, Sep 17, 2011 at 4:47 PM, sukran dhawan sukrandha...@gmail.comwrote: kadane s algo On Sat, Sep 17, 2011 at 3:25 PM, prasanth n

Re: [algogeeks] Re: matrix

2011-09-17 Thread prasanth n
(The element which make largest sum is\t); for(j=s;j=e;j++) { printf(%d\t,a[j]); } } int main() { int a[]={6,4,-5,5,2,8,-21,15,4}; int n=9; largestsum(a,n); return 0; } Thanks Regards Sinjan M.Tech(s/w engg) DTU delhi On Sep 17, 2:55 pm, prasanth n nprasnt

[algogeeks] binary tree

2011-09-17 Thread prasanth n
You are given a binary tree in which each node contains a value. Design an ALGORITHM to print all paths which sum up to that value. Note that it can be any path in the tree - it does not have to start at the root. -- *prasanth* -- You received this message because you are subscribed to the

Re: [algogeeks] Find the element in Array

2011-09-16 Thread prasanth n
@sarath: it is not specified that the range is from 1 to n..it may look like this: 1 99 2 99 here you cant access a[99].. On Fri, Sep 16, 2011 at 7:28 PM, sarath prasath prasathsar...@gmail.comwrote: this is one is the elegant solution i came across if u got an element just go to the

[algogeeks] hash

2011-09-16 Thread prasanth n
can anyone tell how to implement a hash table in C?? how to choose the hash function?? algorithm?? -- *prasanth* -- 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

[algogeeks] question on algorithm

2011-09-16 Thread prasanth n
Given an infinite number of quarters (25 cents), dimes (10 cents), nickels (5 cents) and pennies (1 cent), write code to calculate the number of ways of representing n cents. also do give an algorithm first.. -- *prasanth* -- You received this message because you are subscribed to the Google

Re: [algogeeks] Re: question on algorithm

2011-09-16 Thread prasanth n
; On Sep 16, 1:35 pm, prasanth n nprasnt...@gmail.com wrote: Given an infinite number of quarters (25 cents), dimes (10 cents), nickels (5 cents) and pennies (1 cent), write code to calculate the number of ways of representing n cents. also do give an algorithm first.. -- *prasanth

Re: [algogeeks]

2011-09-13 Thread prasanth n
use dynamic programming.. On Sun, Sep 4, 2011 at 6:46 PM, aditya kumar aditya.kumar130...@gmail.comwrote: How to find longest common substring in two strings ? i want efficent code and iff possible any method other than using suffix tree . -- You received this message because you are

[algogeeks] stack using bst

2011-08-25 Thread prasanth n
how to implement a stack(push and pop) using binary search tree?? -- *prasanth* -- 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] Citrix C Question

2011-08-24 Thread prasanth n
@ankur: i think its error..l value required On Wed, Aug 24, 2011 at 11:18 PM, Ankur Garg ankurga...@gmail.com wrote: Hi Suppose there is a program int main(){ printf(%t,main()); sleep(1000); return 0; } The above program is run from 100 different windows What will be the

Re: [algogeeks] apti

2011-08-21 Thread prasanth n
miles before as it is on its normal time, so no change in its position. then, when the cyclist covers that 1 mile, the train covers 5 miles so that both of them meet at the station. thus, speed of the train = 5*speed of cyclist = 60 miles/hour On Sun, Aug 21, 2011 at 12:19 PM, prasanth n nprasnt

Re: [algogeeks] Re: Global Scholar

2011-08-06 Thread prasanth n
@vicky written: 3 c and ds multiple choice questions 2 java questions 1 dbms 1 c++ 5 coding quesions.. 1) you will be given 2 binary tree..you have to find the intersecting node.. 2) rotating an image by 90 degree.. that all i remember.. round 1: 1*) rotating *a linked list..only recursion and

Re: [algogeeks] Microsoft Qn: Algo to find the border of a binary tree

2011-07-17 Thread prasanth n
@sourabh jakhar: how to design that big int class?? what data structure to use?? On Sun, Jul 17, 2011 at 3:55 PM, sourabh jakhar sourabhjak...@gmail.comwrote: i donot know abt the results but one thing for sure get your basic first right and than do the weird question On Sun, Jul 17, 2011

Re: [algogeeks] Microsoft Qn: Algo to find the border of a binary tree

2011-07-17 Thread prasanth n
. On Sun, Jul 17, 2011 at 5:28 PM, sagar pareek sagarpar...@gmail.comwrote: @prasanth Trie will be used... :) :) On Sun, Jul 17, 2011 at 5:28 PM, sagar pareek sagarpar...@gmail.comwrote: @saurabh Ok... on 20th amazon is coming :) On Sun, Jul 17, 2011 at 4:35 PM, prasanth n

Re: [algogeeks] Microsoft Qn: Algo to find the border of a binary tree

2011-07-17 Thread prasanth n
@sagar pareek: thanks On Sun, Jul 17, 2011 at 6:50 PM, sagar pareek sagarpar...@gmail.com wrote: yeah it can be On Sun, Jul 17, 2011 at 6:47 PM, prasanth n nprasnt...@gmail.com wrote: @sagar pareek: we cant use linked list ah?? On Sun, Jul 17, 2011 at 6:44 PM, sagar pareek sagarpar