[algogeeks] Re: partition array

2011-01-19 Thread manoj
if you don't distroy the oder in which elements are stored in array then this problem is just a cake walk. Requirement of question? On Jan 19, 11:49 am, Aditya adit.sh...@gmail.com wrote: this could be solved by using dynamic programing (knapsack problem) On 1/19/2011 12:30 AM, juver++ wrote:

[algogeeks] Re: google mcqs

2011-01-19 Thread bittu
Q4 its One Binary Semaphore problem try different combination while preserving original values of S T Q2 A Please Read Out SJF (CPU Scheduling Algorithm) Q3 C.. Please Read What is Paging Page Fault --performance is Answer Chosen By Navies not Experts.. Actual Answer is Less Page Faults

[algogeeks] Re: Building A Special Tree

2011-01-19 Thread bittu
How we can build a tree with only one traversal ..i think to build a tree atlesat two traversal required e.g N / \ N N / \ / \ N L NL / \ / \ N NN N so preorder is given by NLL Therefore, following combination can

[algogeeks] Re: Building A Special Tree

2011-01-19 Thread juver++
@bittu We have complete binary tree. Preorder information about nodes and leaves is enough. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send

[algogeeks] Re: find triplets in an integer array A[] which satisfy condition: a[i]^2 + a[j]^2 = a[k]^2

2011-01-19 Thread bittu
Algo loop down array find 2 elements such that c= sqrt(a*a + b*b) compare if( c*c ==a*a+b*b) //can be optimized we can leave this line just writing fro clarification if yes prints all the combination For This I Have A Gud Working Solution which has time complexity of O(n^2) Lets genralize

[algogeeks] Re: Sites for Interview Questions

2011-01-19 Thread Aviral Gupta
http://coders-stop.blogspot.com/ On Jan 19, 12:47 pm, Decipher ankurseth...@gmail.com wrote: Careercup.com is best but for beginners you can also see geeksforgeeks.org . -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

[algogeeks] Re: Amazon Again

2011-01-19 Thread bittu
@radha krishnanan do u means this http://en.wikipedia.org/wiki/Matrix_exponential anyways got it. Regards Shashank -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To

[algogeeks] Re: Largest BST in Binary Tree

2011-01-19 Thread bittu
@balaji...Gud work..man Keep goin On -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For

[algogeeks] Google Question

2011-01-19 Thread bittu
Given 1. A 2. Ctrl+A 3. Ctrl+C 4. Ctrl+V If you can only press the keyboard for N times (with the above four keys), please write a program to produce maximum numbers of A. If possible, please also print out the sequence of keys. So the input parameter is N (No. of keys that you can press), the

[algogeeks] Re: Google Question

2011-01-19 Thread juver++
Keys 23 may be combined, cause there is no sense to use them separately. It's cost of pressing is 2, however. For all other keys the cost is 1 though. DP[i][n] - maximum number of A's we can produce with cost of pressings = i and we have string of A's with size n in a clipboard. DP[N][any] -

[algogeeks] Re: Building A Special Tree

2011-01-19 Thread juver++
@above You create your binary tree from scratch. Where is an input data with preorder labels? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group,

[algogeeks] Re: Google Question

2011-01-19 Thread Raj
http://www.ihas1337code.com/2011/01/ctrla-ctrlc-ctrlv.html On Jan 19, 8:28 pm, bittu shashank7andr...@gmail.com wrote: Given 1. A 2. Ctrl+A 3. Ctrl+C 4. Ctrl+V If you can only press the keyboard for N times (with the above four keys), please write a program to produce maximum numbers of

Re: [algogeeks] Re: Google Question

2011-01-19 Thread nishaanth
How about the following dynamic programming solution. Let dp[i] be the max no of As with i keystrokes. dp[i]=max(dp[i-1]+1,2*dp[i-3]) dp[N] is the required solution. Correct me if i am wrong. On Wed, Jan 19, 2011 at 9:20 PM, Raj rajmangaltiw...@gmail.com wrote:

Re: [algogeeks] Re: google mcqs

2011-01-19 Thread nishaanth
RAM Question ;- Ans D... Larger RAM - Larger number of frames per process - lesser number of pagefaults - increased performance. Scheduling :- Ans D..All are correct. @all those guys who say only I and III, why not II ? Preemption doesnt guarantee bounded waiting.Starvation may still happen.

[algogeeks] Re: Amazon Again

2011-01-19 Thread Dave
If the matrix is diagonalizable, then it can be raised to any power in O(n^3) independent of k. Find the eigenvalue/eigenvector decomposition of the matrix, raise the eigenvalues to power k, and then multiply on the right and left by the matrix of eigenvectors and its inverse, respectively. Dave

Re: [algogeeks] Re: google mcqs

2011-01-19 Thread Anand
Pipeline : Choice B : 165 ( this pipeline wastes 20 ns between last 2 stages for each item ) Scheduling : Choice B Few page faults : Choice D Synchronization : Choice B On Wed, Jan 19, 2011 at 10:26 AM, nishaanth nishaant...@gmail.com wrote: RAM Question ;- Ans D... Larger RAM - Larger number