Something like this
1
2 3
4 5 67
1
|
2-3
|
4-5-6-7
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
python int has no bounds, it can scale upto the mem u have available on your
computer.
On Thu, May 13, 2010 at 7:53 AM, Nikhil Agarwal
nikhil.bhoja...@gmail.comwrote:
@jitendra: your python code is awesome and it works.:)
On Wed, May 12, 2010 at 6:37 PM, divya jain
Do a post-order traversal, keeping track of the level in the tree. As
you visit each node, remove it from the tree and add it to the spike.
Use the left pointer to point to the next level, and the right tree
pointer for each level of the spike. If you visit the right subtrees
before the left
use BFS traversal method
-- Prashant Kulkarni
|| Lokaha Samastaha Sukhino Bhavanthu ||
|| Sarve Jana Sukhino Bhavanthu ||
On Wed, May 12, 2010 at 8:48 PM, vinayan c vinayan1...@gmail.com wrote:
Something like this
1
2 3
4
given a bst... find two nodes whose sum is equal to a number k ... in O(n)
time and constant space...
--
With Regards,
Jalaj Jaiswal
+919026283397
B.TECH IT
IIIT ALLAHABAD
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this
array and linked list are not the same so all solutions based on array
are wrong.
think this way : how to print(or append in a linked list) the binary
search tree in the sorted order -- the answer is in-order traversal.
you need to do opposite of it here.
On May 12, 10:17 am, divya jain
You are given two sorted lists of size m and n. Give an O(log m+log n)
time algorithm for computing the kth smallest element in the union of
the two lists
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
do bfs.
On 13 May 2010 09:18, vinayan c vinayan1...@gmail.com wrote:
Something like this
1
2 3
4 5 67
1
|
2-3
|
4-5-6-7
--
You received this message because you are
This problem was asked in google phone interview. We have N element
array with k distinct keys(No relation between k N given so assume
kN)
What is the best method to sort this array without using any extra
memory? Please elaborate.
--
You received this message because you are subscribed to the
the best approach to it is to build a balanced tree from bottom to up rather
than top to bottom.
On 12 May 2010 22:47, divya jain sweetdivya@gmail.com wrote:
thanks a lot to all for their replies..
On 9 May 2010 11:23, rahul rai raikra...@gmail.com wrote:
can anyone give me links to
Using BFS we can do it.
Thanks,
Sathaiah
On Thu, May 13, 2010 at 6:48 PM, Dave dave_and_da...@juno.com wrote:
Do a post-order traversal, keeping track of the level in the tree. As
you visit each node, remove it from the tree and add it to the spike.
Use the left pointer to point to the next
input a character array from the user and output in the following way.
example string is amazon.. then output should be a2m1z1o1n1
i did it taking a 26 size array... some better solution ??
--
With Regards,
Jalaj Jaiswal
+919026283397
B.TECH IT
IIIT ALLAHABAD
--
You received this message
Do a breadth first search on the tree and link all nodes at the same
level in the order that you process them
--Anurag
On Thu, May 13, 2010 at 9:18 AM, vinayan c vinayan1...@gmail.com wrote:
Something like this
1
2 3
4 5
it looks like left child right sibling relation ??? isn't it ?
On Thu, May 13, 2010 at 9:18 AM, vinayan c vinayan1...@gmail.com wrote:
Something like this
1
2 3
4 5 67
1
|
2-3
|
4-5-6-7
can some1 post the solution here..the link by dufus is not working and i'm
not able to find any other relevant link to this problem.
On Sat, Sep 19, 2009 at 1:44 PM, ankur aggarwal ankur.mast@gmail.comwrote:
thanxs dufus.
got the soln
On Fri, Sep 18, 2009 at 8:20 PM, Dufus
This can be done with level order traversal of the tree
Algorithm
count = count2 = 0
1. Push the root in the queue.
2. keep count at each level for root count =1
3. while(queue not empty)
4. push all childs of node at the top of queue in queue
5. count2 += (number of childs of node at
cant u use a hash map of O(K) where K is distinct elements in
string..
On Thu, May 13, 2010 at 8:13 PM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote:
input a character array from the user and output in the following way.
example string is amazon.. then output should be a2m1z1o1n1
i
This is for kth largest. Change it for kth smallest
In fact, this problem is amenable to something very similar to binary
search. Suppose my arrays are A and B. The idea is to keep track of two
indices, a (for A) and b (for B), such that a + b = k - 1 (it's very
important to maintain this
exactly ..
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14
On Fri, May 14, 2010 at 10:07 AM, vignesh radhakrishnan
rvignesh1...@gmail.com wrote:
This is for
This was also asked in my Yahoo! Interview this year. :)
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14
On Fri, May 14, 2010 at 10:10 AM, Rohit Saraf
20 matches
Mail list logo