Re: [algogeeks]Numbers search in an array

2010-06-18 Thread Ashish Mishra
; -- > yezhu malai vaasa venkataramana Govinda Govinda > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send em

[algogeeks] infy color balls

2010-04-30 Thread Ashish Mishra
One of my friend ask me this n i am bad in P & C (will love if smone can provide me a link to learn it though) nyways prob is: there are infy color balls of k different color you are allowed to pick n balls out of those infy(infinite) balls cond is : you must have all k color balls with u obvious

Re: [algogeeks] MXN matrix

2010-04-30 Thread Ashish Mishra
; from (a, b) to (c, d) in O(1) >> >> for N*N matrix, Complexity is O(N^4) >> >> On 28 April 2010 13:36, Ashish Mishra wrote: >> >>> you are given a M x N matrix with 0's and 1's >>> find the matrix with largest number of 1, >>&

Re: [algogeeks] Build BST from binary tree without extra space

2010-04-28 Thread Ashish Mishra
eed to use extra space u have > to just ditach the node from binary tree and attach it in bst. > > On Wed, Apr 28, 2010 at 1:18 AM, Ashish Mishra > wrote: > > How to build BST from binary tree in place i.e without extra space ?? > > > > -- > > You received this

[algogeeks] MXN matrix

2010-04-28 Thread Ashish Mishra
you are given a M x N matrix with 0's and 1's find the matrix with largest number of 1, 1. find the largest square matrix with 1's 2. Find the largest rectangular matrix with 1's -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this

[algogeeks] Build BST from binary tree without extra space

2010-04-27 Thread Ashish Mishra
How to build BST from binary tree in place i.e without extra space ?? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+un

Re: [algogeeks] Re: Implement a queue using a stack

2010-04-14 Thread Ashish Mishra
>>> > > "Algorithm Geeks" group. >>> > >>>> > > To post to this group, send email to >>> algoge...@googlegroups.com. >>> > >>>> > > To unsubscribe from this group, send email to >>> > >>&

Re: [algogeeks] Finding all prime less than 10^8

2010-04-14 Thread Ashish Mishra
ou received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algoge...@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com >&

Re: [algogeeks] efficient backtracking algorithm for the coin changing problem

2010-04-10 Thread Ashish Mishra
y u need backtracking i think it can be done with DP On Sat, Apr 10, 2010 at 9:12 AM, «« ÄÑÜJ »» wrote: > Need help in designing efficient backtracking algorithm for the coin > changing problem. where a1, a2, an are the set of distinct coins > types, where each ai is an integer. and each type is

Re: [algogeeks] Finding youngest common ancestor of two nodes in a binary tree

2010-04-08 Thread Ashish Mishra
yup atul algo is correct (cur_data - node->right) * ( cur_data- node->left) < -1 for ancestors On Thu, Apr 8, 2010 at 10:19 AM, atul verma wrote: > Its very simple to solve this. > > Start from root. > > Compare the value of current node data value to both nodes. > > 1. if both are greater tha

Re: [algogeeks] Divide and Conquer problem

2010-04-08 Thread Ashish Mishra
Can it be done in more or less like merge sort way i.e 1. divide array into half 2. keep on doing it till u have two element left 3. arrang match between two and return winner On Wed, Apr 7, 2010 at 12:20 PM, «« ÄÑÜJ »» wrote: > Can any one help me with this problem > > > Its a divide and co

Re: [algogeeks] Finding youngest common ancestor of two nodes in a binary tree

2010-04-08 Thread Ashish Mishra
i think u mean lowest commen ancestor? On Wed, Apr 7, 2010 at 10:34 PM, Himanshu Aggarwal wrote: > For a given binary tree, given the root and two node pointers, how can we > find their youngest common ancestor. > > Say the node is like: > > struct node{ >int data; >struct node*l

Re: [algogeeks] Re: Largest span of Increasing Pair in an array

2010-03-14 Thread ASHISH MISHRA
@ankur how u can solve it in o(n) i suppose u need atleast o(n lgn) On Sun, Sep 6, 2009 at 2:52 PM, ankur aggarwal wrote: > o(n) is the best sol known to me.. > > > On Sun, Sep 6, 2009 at 1:54 PM, Pramod Negi wrote: > >> i guess sorting will do the work. >> any other constraint?? >> >> >> On Sun