[algogeeks] SPOJ question LITE

2012-06-20 Thread algogeek
#includeiostream using namespace std; struct node { int num; int l,r; node * left; node * right; }; node * create(node * root,int start,int end); node * update(node * root, int i,int j); int query(node * root,int i,int j); main() { int n,q; cinnq; node *

Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-17 Thread algogeek
This solution works perfectly :) On Friday, June 15, 2012 10:59:22 AM UTC+5:30, Navin Kumar wrote: I corrected in function InsertAtBottom :In my code isntead of (!IsEmptyStack) use IsEmptyStack On Fri, Jun 15, 2012 at 10:49 AM, Navin Kumar algorithm.i...@gmail.comwrote: @all: In my

[algogeeks] Re: Directi Question

2012-06-16 Thread algogeek
@maddy: The students should be assigned consecutive books only. That is, u CANNOT assign book 1, 2 and 5 to a single student. either assign book 1, 2 and 3 or 1 and 2 or any such combination of consecutive numbers. On Thursday, June 14, 2012 12:26:09 PM UTC+5:30, algogeek wrote

[algogeeks] Re: Amazon Interview Question

2012-06-16 Thread algogeek
could u explain how would you use a trie for this?? On Thursday, June 14, 2012 1:01:00 PM UTC+5:30, Mohit Rathi wrote: Hi, *There are two arrays of length 100 each. Each of these has initially n (n=100) elements. First array contains names and the second array contains numbers such that

[algogeeks] Directi Question

2012-06-14 Thread algogeek
In a library there are N books with the number of pages in i th book given by bi . These books are to be distributed among K students such that the difference between the largest sum of pages in the books assigned to any student and the smallest sum of number of pages in the books assigned to

[algogeeks] Re: Permutations of a string

2012-06-14 Thread algogeek
Johnson trotter algorithm is another way to generate all permutations.. On Saturday, May 5, 2012 4:08:13 PM UTC+5:30, Sairam wrote: I have written a code which gives all permutations of a string. I have assumed that all the characters in a given string are distinct. The main idea is as

[algogeeks] symmetric binary tree

2012-05-21 Thread algogeek
How to check if a given binary tree is structurally symmetric ie. the left sub tree should be mirror image of right sub tree and vice-versa. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to