Re: [algogeeks] Re: Amazon Question

2011-01-28 Thread Ritu Garg
@nphard,see the following approach carefully to know *if right pointer is pointing to right child or in order successor* * *Q = node->right IF (Q is not NULL) { /*Determine if Q is node's right child or successor*/ /*Q is inorder successor of node*/ IF (Q->left == node OR Q-

Re: [algogeeks] Re: zig zag

2011-01-28 Thread nishaanth
@above...can you please enlighten me about the second term in the dp expression And are you sure its O(n) ? On Fri, Jan 28, 2011 at 7:08 PM, sankalp srivastava < richi.sankalp1...@gmail.com> wrote: > This can be done in O(n) very easily , similar to Longest increasing > subsequence > > Solution :

Re: [algogeeks] Re: Google Question

2011-01-28 Thread Saikat Debnath
@ Nikhil sir : I have coded the same solution, but was waiting for its correctness to be proved... thanx.. :) On Fri, Jan 28, 2011 at 1:01 PM, Nikhil Jindal wrote: > Nishant's soln is incorrect because he assumes, ctrlA and ctrlC are pressed > each time ctrlV is pressed. > As saikat has pointed o

[algogeeks] Re: BST insertion

2011-01-28 Thread juver++
you should return results from the recursive functions, e.g: if(num < (*bt)->data) result = insert_node(&((*bt)->left),num); ... return result; -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algog

[algogeeks] Bootstrap learning of foundational representations Authors: Benjamin J. Kuipers; Patrick Beeson; Joseph Modayil; Jefferson Provosta

2011-01-28 Thread Ian Martin Ajzenszmidt
http://www.informaworld.com/smpp/content~db=all?content=10.1080/09540090600768484 is the source of the following. Search within this journal: About this Journal: Abstracting & Indexing News & Offers Online Submissions Related Websites Society Information What is iFirst? General Information: Pe

[algogeeks] Bootstrap learning for object discovery (2004) Joseph Modayil and Benjamin Kuipers

2011-01-28 Thread Ian Martin Ajzenszmidt
ftp://ftp.cs.utexas.edu/pub/qsim/papers/Modayil-iros-04-obj.pdf is the source of the following. We show how a robot can autonomously learn an ontology of objects to explain many aspects of its sensor input from an unknown dynamic world. Unsupervised learning about objects is an important conceptua

Re: [algogeeks] Re: Google Question

2011-01-28 Thread Nikhil Jindal
Nishant's soln is incorrect because he assumes, ctrlA and ctrlC are pressed each time ctrlV is pressed. As saikat has pointed out, this is incorrect. According to me: *buff = 0; //keeps track of last ctrlC* > *for each i* > *{* > * dp(i)=max(dp(i-1)+1, 2*dp(i-3), dp(i-1) + buff)* > * if(dp(i)==

[algogeeks] BST insertion

2011-01-28 Thread Roshan
I m Trying to make BSTand checking if node already there just return ,trying to return 1 but here its returning 0 , lease help // btree.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include #include struct Node { int data ; struct

[algogeeks] Re: and or tree

2011-01-28 Thread sankalp srivastava
I am not sure you mentioned the problem statement correctly , anyways here goes my solution . recurse(int valuerequired , node * n , int value_now , int steps) { if(node==NULL) return 0; else if(valuerequired== value_now) return steps;

[algogeeks] Re: Prime Numbers

2011-01-28 Thread sankalp srivastava
Correct me if I'm wrong , but according to you , will this be the approach ? boolean array[10]; int primes[100]; void seive() { int index=0; for(int i=2;i*i<10;i++) { if(isprime[i]) { primes[index++]=i; for(int j=i*2;j<100;j+=i)

[algogeeks] Re: zig zag

2011-01-28 Thread sankalp srivastava
This can be done in O(n) very easily , similar to Longest increasing subsequence Solution :- dp[l]= maximum length of the zigzag sequence upto the length l //At any position , the particular number in the array can either extend the zigzag sequence containing the last element or it can start one

Re: [algogeeks] Re: Doubt regarding Pointers in C......

2011-01-28 Thread saurabh gupta
@Nishaanth, boiling down to how things work everything is pass by value in C (or you can argue for hours as Jammy said) when your function prototype contains a pointer it is simply passed (copied) the address which was contained in the variable(pointer here) which was passed during the function cal

Re: [algogeeks] Re: Coding question.............

2011-01-28 Thread saurabh gupta
> correct me if anything wrong > > it's a rectangle. -- Man goes to doctor. Says he's depressed. Says life seems harsh and cruel. Says he feels all alone in a threatening world where what lies ahead is vague and uncertain. Doctor says "Treatment is simple. Great clown Pagliacci is in town tonight

Re: [algogeeks] Re: Puzzle

2011-01-28 Thread saurabh gupta
up vote to 9 + 1 + 1/9 On Thu, Jan 27, 2011 at 6:06 PM, sunny agrawal wrote: > another one > 9*(1+ 1/9) > > > On Thu, Jan 27, 2011 at 5:40 PM, nhkrishna2...@yahoo.com < > nhkrishna2...@gmail.com> wrote: > >> 9+1+1/9 >> >> >> >> On Jan 27, 4:43 pm, ankit agarwal wrote: >> > (9*9-1)/(9-1) >> > >>

Re: [algogeeks] Re: Suggestions required regarding my final year Project....

2011-01-28 Thread saurabh gupta
wrong forum. On Fri, Jan 28, 2011 at 6:29 PM, Venu wrote: > Thanks pawan...Actually, i wanted to do a project related to Data > Mining...Do you have any ideas related to this area ??? > > On Jan 28, 10:43 am, pawan gangwani wrote: > > Hi Rajeev/venu, > > > > i suggest you to think of a domain o

Re: [algogeeks] Re: Good Maths Question

2011-01-28 Thread nishaanth
@All... According to the constraints(SPOJ problem) wont this dp solution time out ? On Tue, Jan 25, 2011 at 12:23 AM, sankalp srivastava < richi.sankalp1...@gmail.com> wrote: > Correct me if I'm wrong > > dp[i][j]=how many numbers of length i with the last digit j(int base > 10) > dp[0][j]=0 > dp

[algogeeks] Re: Suggestions required regarding my final year Project....

2011-01-28 Thread Venu
Thanks pawan...Actually, i wanted to do a project related to Data Mining...Do you have any ideas related to this area ??? On Jan 28, 10:43 am, pawan gangwani wrote: > Hi Rajeev/venu, > > i suggest you to think of a domain of you interest first, then proceed in > that direction thinking of some pr

[algogeeks] Re: Coding question.............

2011-01-28 Thread bittu
well it can be done using recursion void Transpose(int** A, int N) // Square size - 1 { if(N == 0) // Transpose of a 1 X 1 Matrix return; else { Transpose(A,N-1); for(int i=0; ihttp://groups.google.com/group/algogeeks?hl=en.

[algogeeks] Amazon Again

2011-01-28 Thread bittu
There are N petrol pumps along a circular path. Every petrol pump gives some amount of fixed petrol. Need not to be unique and in no particular order means it is random. We have a car and we need to find a petrol pump which can provide so much of petrol that we can take a full of the circle. Mileag