Re: [algogeeks] Matrix Minimum Path Sum

2012-06-04 Thread atul anand
this recurrence wont work..ignore On Mon, Jun 4, 2012 at 8:55 AM, atul anand atul.87fri...@gmail.com wrote: find cumulative sum row[0] find cumulative sum of col[0] after this following recurrence will solve the problem. start from mat[1][1] mat[i][j]=mat[i][j]+min( mat[i][j-1] ,

Re: [algogeeks] Matrix Minimum Path Sum

2012-06-04 Thread Hassan Monfared
for non-negative values Dijkstra will solve the problem in ( O(N^2) ) and Floyd-Warshal is the solution for negative cells. ( O(N^3) ) On Mon, Jun 4, 2012 at 11:20 AM, atul anand atul.87fri...@gmail.com wrote: this recurrence wont work..ignore On Mon, Jun 4, 2012 at 8:55 AM, atul anand

Re: [algogeeks] Matrix Minimum Path Sum

2012-06-04 Thread atul anand
i dont think so dijistra will worh here..bcozz we cannot move diagonally ...but according to matrix this path can be considered. On Mon, Jun 4, 2012 at 1:39 PM, Hassan Monfared hmonfa...@gmail.com wrote: for non-negative values Dijkstra will solve the problem in ( O(N^2) ) and Floyd-Warshal is

Re: [algogeeks] Re: amazon interview questions

2012-06-04 Thread utsav sharma
@hasan :-ohhh sorry, i didn't see the outer loop yeah, it works but it is O(n^2), required solution is of O(n). On Mon, Jun 4, 2012 at 11:20 AM, Hassan Monfared hmonfa...@gmail.comwrote: utsav: It works fine, I did little bug fixing on boundaries as here goes : bool IsValid(string s) {

[algogeeks] LINKED LIST QUESTION

2012-06-04 Thread VIHARRI
Hi we need find a node in linked list in O(logn). You can change the list as u like. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/vSoEXlaRTEIJ. To post

Re: [algogeeks] LINKED LIST QUESTION

2012-06-04 Thread Amol Sharma
not possible i suppose.. -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad http://gplus.to/amolsharma99 http://twitter.com/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://www.simplyamol.blogspot.com/ On Mon, Jun 4, 2012 at 3:00 PM,

Re: [algogeeks] MS Question: Delete a node in single linked list if it is less than any of the successor nodes

2012-06-04 Thread Amol Sharma
here is the question ans solution with proper explanation http://www.geeksforgeeks.org/archives/11604 -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad http://gplus.to/amolsharma99

Re: [algogeeks] Simple Question ,Find Error

2012-06-04 Thread Raghavendhra Chowdary MV
names[3] = names[4]; //Cant be done like these as they are char arrays On Mon, Jun 4, 2012 at 4:12 AM, mahendra sengar sengar.m...@gmail.comwrote: main() { static char names[5][20]={pascal,ada,cobol,fortran,perl}; int i; char *t; t=names[3]; names[3]=names[4]; names[4]=t; for

Re: [algogeeks] LINKED LIST QUESTION

2012-06-04 Thread Jeevitesh
This is possible only if Linked List is sorted then we can apply Merge Sort for Linked List which would be in place. Otherwise the time complexity would be O(n logn). On Mon, Jun 4, 2012 at 3:00 PM, VIHARRI viharri@gmail.com wrote: Hi we need find a node in linked list in O(logn). You can

[algogeeks] Google Developer Group, New Delhi - HACK 2012 - Code for a Cause !

2012-06-04 Thread Shrey Malhotra
Dear all, On behalf, of *Google Developer Group New Delhi *(formerly known as* GTUG New Delhi*) , I would like to inform you that we are going to host *H-A-C-K - Code for a Cause, *a hackathon, on *16-17th June* at the *Indian Habitat Center, New Delhi*. *HACK- Code for a Cause* is being

Re: [algogeeks] Re: amazon interview questions

2012-06-04 Thread Jeevitesh
i have not implemented it but i can you an idea how to approach it. Go to Each suffix in suffix or suffix array(I would prefer suffix array as it is easier) traverse the each suffix till you encounter the first letter of the suffix you are traversing and check to see this suppose i is the index

Re: [algogeeks] Simple Question ,Find Error

2012-06-04 Thread Nishant Pandey
actually the address of name is constant and that get modifed , so thats not possible once name is converted to pointer then this assignment is posible . On Mon, Jun 4, 2012 at 10:51 AM, Hassan Monfared hmonfa...@gmail.comwrote: you can't assign value into names[i]! On Mon, Jun 4, 2012 at

Re: [algogeeks] Re: MS: searching problem......help me out...

2012-06-04 Thread Rahul Kumar Patle
i think gene is correct in normal RAM it is impossible @abhishek you are talking about parallel algorithms but till this extent is not possible to implement in general computers.. @abhinav you was correct.. firsst we will have to make heap tree which is impossible in log(n) time... On Sun,

Re: [algogeeks] LINKED LIST QUESTION

2012-06-04 Thread SANDEEP CHUGH
can be done using skip lists On Mon, Jun 4, 2012 at 3:03 PM, Jeevitesh jeeviteshshekha...@gmail.comwrote: This is possible only if Linked List is sorted then we can apply Merge Sort for Linked List which would be in place. Otherwise the time complexity would be O(n logn). On Mon, Jun 4,

Re: [algogeeks] Matrix Minimum Path Sum

2012-06-04 Thread Hassan Monfared
moving must be done in A* style On Mon, Jun 4, 2012 at 1:17 PM, atul anand atul.87fri...@gmail.com wrote: i dont think so dijistra will worh here..bcozz we cannot move diagonally ...but according to matrix this path can be considered. On Mon, Jun 4, 2012 at 1:39 PM, Hassan Monfared

Re: [algogeeks] LINKED LIST QUESTION

2012-06-04 Thread atul anand
as question says you can change the list as u like...i guess skip list is the answer. On Mon, Jun 4, 2012 at 3:51 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: can be done using skip lists On Mon, Jun 4, 2012 at 3:03 PM, Jeevitesh jeeviteshshekha...@gmail.comwrote: This is possible only

Re: [algogeeks] MS Question: Delete a node in single linked list if it is less than any of the successor nodes

2012-06-04 Thread atul anand
whats problem with the approch provided by navin http://k2code.blogspot.in/2011/09/deleting-node-in-singly-linked-list-if.html it seems much simpler ...is there any test case for which it wont work ?? On Mon, Jun 4, 2012 at 3:25 PM, Amol Sharma amolsharm...@gmail.com wrote: here is the

Re: [algogeeks] If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2012-06-04 Thread Abhishek Sharma
mailing you the link for same On Mon, Jun 4, 2012 at 1:31 AM, Dhaval Moliya moliyadha...@gmail.comwrote: If any one have algorithms for interviews by adnan aziz ebook... Please mail ... Thanks -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

[algogeeks] interview HARD problem

2012-06-04 Thread Ashish Goel
Given a dictionary of millions of words, give an algorithm to find the largest possible rectangle of letter that every row forms a word(reading left to right) and every column forms a word(reading from top to bottom). Best Regards Ashish Goel Think positive and find fuel in failure +919985813081

Re: [algogeeks] interview HARD problem

2012-06-04 Thread Hassan Monfared
Give a sample please On Mon, Jun 4, 2012 at 5:34 PM, Ashish Goel ashg...@gmail.com wrote: Given a dictionary of millions of words, give an algorithm to find the largest possible rectangle of letter that every row forms a word(reading left to right) and every column forms a word(reading from

Re: [algogeeks] Matrix Minimum Path Sum

2012-06-04 Thread Decipher
@Victor - Someone had asked this question from me !! He told me its from Project Euler Q-83. @Hassan - I think you are right. This question can be solved by Dijikstra's algo, if we consider the matrix elements as weights. On Monday, 4 June 2012 16:28:31 UTC+5:30, Hassan Monfared wrote:

Re: [algogeeks] LINKED LIST QUESTION

2012-06-04 Thread Nishant Pandey
Hi , I think the only possiblity is to make it doubly linked list and then consider next prev as left and right child like tree and then perform search as we in tree , it would serve the purpose . let me know if iam wrong . On Mon, Jun 4, 2012 at 3:51 PM, SANDEEP CHUGH

RE: [algogeeks] Simple Question ,Find Error

2012-06-04 Thread abhishek
This code have issue. names[3]=names[4]; names[4]=t; -Original Message- From: algogeeks@googlegroups.com [mailto:algogeeks@googlegroups.com] On Behalf Of mahendra sengar Sent: Monday, June 04, 2012 4:13 AM To: Algorithm Geeks Cc: sengar.m...@gmail.com Subject: [algogeeks] Simple Question

Re: [algogeeks] Simple Question ,Find Error

2012-06-04 Thread sengar.mahi
Answer: Compiler error: Lvalue required in function main This was the answer given along with the question..pls explain !! On Mon, Jun 4, 2012 at 10:04 PM, abhishek zeal.gosw...@gmail.com wrote: This code have issue. names[3]=names[4]; names[4]=t; -Original Message- From:

Re: [algogeeks] Re: amazon interview questions

2012-06-04 Thread Abhishek Sharma
I think it can be done by modifying the h-array and by making some changes in KMP-algorithm On Mon, Jun 4, 2012 at 9:35 AM, Jeevitesh jeeviteshshekha...@gmail.comwrote: i have not implemented it but i can you an idea how to approach it. Go to Each suffix in suffix or suffix array(I would

Re: [algogeeks] Digest for algogeeks@googlegroups.com - 25 Messages in 6 Topics

2012-06-04 Thread Dhaval Moliya
@Viharri: You can use skip list. On Mon, Jun 4, 2012 at 3:30 PM, algogeeks@googlegroups.com wrote: Today's Topic Summary Group: http://groups.google.com/group/algogeeks/topics - MS Question: Delete a node in single linked list if it is less than any of the successor nodes

Re: [algogeeks] interview HARD problem

2012-06-04 Thread Ashish Goel
preparing a sample itself is a great problem here, that is why i called it hard all words in the rectangle horizontally as well as vertically needs to be valid dictionary words Ashish Hassan say this rectangle AH,SA,HS,IS,SA,HN should also be valid dictonary words, indeed they are not..

Re: [algogeeks] LINKED LIST QUESTION

2012-06-04 Thread atul anand
well converting single linked list to balanced BST...this would also work On Mon, Jun 4, 2012 at 4:29 PM, Nishant Pandey nishant.bits.me...@gmail.com wrote: Hi , I think the only possiblity is to make it doubly linked list and then consider next prev as left and right child like tree and