Re: [algogeeks] how can i find size of an object in java

2009-11-25 Thread Abhijeet Kumar
how do i measure the JVM memory ??? can u specify a command or class to use?? On Wed, Nov 25, 2009 at 8:12 AM, Chakravarthi Muppalla chakri...@gmail.comwrote: measure jvm memory usage before/after creating ur object; but it is not assured to give the correct size(gc). or u can use a premain

Re: [algogeeks] how can i find size of an object in java

2009-11-25 Thread daizi sheng
java normally pre-alloc much memory and so you have no way to get the actual heap usage with simple method. normally for a given jvm, the size of an object can be calculated statically. what you need is to read source code of jvm, :) anyway, you can simple estimate size of an object as the

Re: [algogeeks] Transitive Closure of a Undirected graph

2009-11-25 Thread Ankur Parashar
Use Flyod Warshal.All pair shortest path algo. initialise d[0] = 1 (i,j) is and edge now apply flyod warhsal On Wed, Nov 25, 2009 at 8:59 AM, Aditya Shankar iitm.adityashan...@gmail.com wrote: On Tue, Nov 24, 2009 at 10:46 PM, Rohit Saraf rohit.kumar.sa...@gmail.com wrote: i had

Re: [algogeeks] Transitive Closure of a Undirected graph

2009-11-25 Thread Aditya Shankar
On Wed, Nov 25, 2009 at 2:13 PM, Ankur Parashar ankurlnm...@gmail.comwrote: Use Flyod Warshal.All pair shortest path algo. initialise d[0] = 1 (i,j) is and edge now apply flyod warhsal That is O(n^3) right? On Wed, Nov 25, 2009 at 8:59 AM, Aditya Shankar iitm.adityashan...@gmail.com

Re: [algogeeks] Search in a sorted NxN matrix

2009-11-25 Thread Aditya Shankar
On Wed, Nov 25, 2009 at 2:16 PM, Bharath bharath1...@gmail.com wrote: You can actually do it in O(logn) complexity. Binary Search on diagonal and then on a row. Will that always work? 1 2 3 3 5 6 4 7 8 Find(6) fails with the usual binary search algorithm. On Tue, Nov 24, 2009 at 10:33

Re: [algogeeks] how can i find size of an object in java

2009-11-25 Thread Phani Kumar
java.lang.Runtime class has a method* freeMemory http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#freeMemory%28%29()* which returns the amount of free memory in the JVM. You can call this method before creating an object and after creating an object. On Wed, Nov 25, 2009 at 4:04

Re: [algogeeks] Search in a sorted NxN matrix

2009-11-25 Thread Arun
how about splitting the matrix into 4 squares and considering the rightmost bottom and comparing it to topmost left corner of each square. in every iteration you will eliminate atleast one square. so worst case, you have to repeat this divide and conquer on the three other squares. not good as as

Re: [algogeeks] finding nth element of a tree without using recursion..

2009-11-25 Thread Raghavendra Sharma
what is nth element of a tree u mean nth element in the inorder traversal? @sharad what are u trying to do with this code?? On Fri, Nov 6, 2009 at 4:01 PM, sharad kumar aryansmit3...@gmail.comwrote: stackstruct node *st; start with root ptr=root; while(ptr!=nullcount!=k) { st.push(ptr);

Re: [algogeeks] how can i find size of an object in java

2009-11-25 Thread Antony Vincent Pandian.S.
But you cant actually say that this is the size of the object from calling freememory before and after object creation.. On Wed, Nov 25, 2009 at 5:15 PM, Phani Kumar gsphaniku...@gmail.com wrote: java.lang.Runtime class has a method* freeMemory

Re: [algogeeks] Transitive Closure of a Undirected graph

2009-11-25 Thread Rohit Saraf
i have got the O(n^2) solution. I will post it by night whenever i get to my comp. -- 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

Re: [algogeeks] Search in a sorted NxN matrix

2009-11-25 Thread sharad kumar
isnt it similar to youngs tabulaeau as gvn in CLRS On Wed, Nov 25, 2009 at 5:18 PM, Arun arunm...@gmail.com wrote: how about splitting the matrix into 4 squares and considering the rightmost bottom and comparing it to topmost left corner of each square. in every iteration you will eliminate

[algogeeks] Re: Search in a sorted NxN matrix

2009-11-25 Thread Geoffrey Summerhayes
Not a bad start, it can eliminate areas. n n n n ?? ?? ?? ?? n n n n ?? ?? ?? ?? n n n n ?? ?? ?? ?? n n n n ?? ?? ?? ?? ?? ?? ?? ?? n n n n ?? ?? ?? ?? n n n n ?? ?? ?? ?? n n n n So it would involve searching in the two remaing blocks, recursively until you get an 1xN or Mx1 then a binary

Re: [algogeeks] Search in a sorted NxN matrix

2009-11-25 Thread Rohit Saraf
Arun's idea was what i tried for the nxm version of this problem. And the log(n) wala is not correct for sure. -- 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

Re: [algogeeks] Search in a sorted NxN matrix

2009-11-25 Thread Bharath
Bsearch on diagonal elimanates all the submatrix under 9. You are left with only one column and a row.Do BinarySearch on these lists. On Wed, Nov 25, 2009 at 6:07 PM, chitta koushik koushik.infin...@gmail.comwrote: @Bharath I dont think BinSrch on diagnol and then on row works. Can u

Re: [algogeeks] Search in a sorted NxN matrix

2009-11-25 Thread Rohit Saraf
it's not similar it's same !! -- 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+unsubscr...@googlegroups.com. For more

Re: [algogeeks] how can i find size of an object in java

2009-11-25 Thread Danny Trieu
Use JNI to do native call. Otherwise, use Sigar api from http://www.hyperic.com/products/sigar.html. --danny On Tue, Nov 24, 2009 at 11:07 AM, Abhijeet Kumar abhijeet.k.s...@gmail.comwrote: How can i find size of an object in java plsss answer asap -- You received this message because

[algogeeks] Re: Search in a sorted NxN matrix

2009-11-25 Thread Geoffrey Summerhayes
Hmmm. Same idea, much more analysis. I feel good, I spent a lot less time thinking about it. Splitting the search areas into squares is a great idea. -- Geoff On Nov 25, 8:43 am, Rohit Saraf rohit.kumar.sa...@gmail.com wrote: A research article on this question.. Rohit Saraf Sophomore