Re: [algogeeks] GREGOVIA in SPOJ

2017-11-25 Thread bujji jajala
gave is to show that choosing greedily arbitrarily does not give optimal solution because some other better solution exists. -Thanks Bujji On Sat, Nov 18, 2017 at 1:17 AM, MeHdi KaZemI <mehdi.kaze...@gmail.com> wrote: > > The Greedy observation is something like this: the leftmost

[algogeeks] GREGOVIA in SPOJ

2017-11-16 Thread bujji jajala
rom left edge to right edge. (2+4 =6). But we can see if we choosing greedily from one end gives cost 2+1+1 = 4. Why greedy approach from one end succeeds while choosing arbitrarily fails. Any hints or proofs is greatly appreciated. -- -Thanks Bujji -- You received this message because

[algogeeks] 25 persons seated in a round table puzzle

2015-07-22 Thread bujji jajala
transfer cards at same instant ). Prove that at some point of time, some person will have same number on both his cards. -Thanks Bujji -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from

[algogeeks] Rank of an element it given index in max heap

2015-06-26 Thread bujji jajala
starts from 0) is 5. We can use additional storage. -Thanks Bujji -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com.

[algogeeks] Best Data structure to store/retrieve Players rank

2015-06-26 Thread bujji jajala
score(int player_id); void updateScore( int plaer_id, int score ); -Thanks Bujji -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr

[algogeeks] Given sequence A_k, k=[1,n] find min{A_k} k=[i,j] in O(logn) time with O(n) memory

2014-07-23 Thread bujji jajala
structure can use O(n log n) space and have O(log n) query time. -Thanks Bujji -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr

[algogeeks] Design Questions/Answers with UML

2014-04-28 Thread bujji jajala
Hi, Can you please where can I get get design questions like air traffic controller, Lift, parking system, Logging module with answers, UML diagrams, possible solutions? Any online resources or even a good book to buy? -Thanks Bujji -- You received this message because you

Re: [algogeeks] Minimum number of coins to SUM to S

2014-04-23 Thread bujji jajala
in proof. @Dave Can you give some intuition behind your statement? -Thanks Bujji On Wed, May 29, 2013 at 8:54 PM, Ravi Ranjan ravi.cool2...@gmail.comwrote: @DAve any proper reason or link to proof that at least twice can be solved using greedy but others are not?? On Tue, May 28, 2013

Re: [algogeeks] Re: Shortest path in grid with dynamic programming.

2014-04-21 Thread bujji jajala
with different path lengths and order of evaluation of paths.Evaluating recursion paths from greater run length to smaller run lengths will result in updating distance[i][j] several times. Any improvements can we think of to improve this to achieve O(XY) bound? -Thanks Bujji. On Mon, Apr 21, 2014

Re: [algogeeks] Re: Shortest path in grid with dynamic programming.

2014-04-21 Thread bujji jajala
Hi Don, At most we can reach a point from 4 adjacent points. So, time complexity will be O(XY) only. -Thanks, Bujji. On Mon, Apr 21, 2014 at 1:38 PM, bujji jajala jajalabu...@gmail.com wrote: Hi Don, Nice solution. good. Looks like in your markShortestPath(int

[algogeeks] Shortest path in grid with dynamic programming.

2014-04-20 Thread bujji jajala
) algorithm. If we walk in down or right directions only Dynamic programming solution would be simple. But because of bad intersection points, we may need to walk in up, down, right or left directions. -Thanks Bujji -- You received this message because you are subscribed to the Google Groups

[algogeeks] Optimum number of drops decays as n^(1/k) to find critical floor with k eggs, n floors

2014-04-20 Thread bujji jajala
of egg droppings that will always suffice. Show that E(k, n) = Θ(n^(1/k)) -Thanks Bujji -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr

Re: [algogeeks] Breaking a string problem (Dynamic programming)

2014-04-20 Thread bujji jajala
Hi Raja, You can store positions cuts in a separate 2d array ( say C[i][j] ) similar to S[i,j] to store optimal cut position for string running from index i to j and use recursion to print cut positions. -Thanks Bujji On Thu, Oct 17, 2013 at 3:21 AM, kumar raja rajkumar.cs

Re: [algogeeks] Find a specific set of numbert

2014-04-20 Thread bujji jajala
Hi Varun, Are there any restrictions on k1, k2, k3 ... ? If not Just choose k_i = a_i i=1,2,..,n. :-) -Thanks Bujji On Sat, Mar 23, 2013 at 7:23 AM, Varun tewari.va...@gmail.com wrote: Hello all, I have this problem to solve, and seek your assistance. Program should

Re: [algogeeks] Re: DISTINCT Permutations ( Not Easy)

2014-01-11 Thread bujji jajala
Hi Don, Good one :) Nice to see different approaches for this problem. -Thanks, Bujji On Fri, Jan 10, 2014 at 9:11 AM, Don dondod...@gmail.com wrote: Sort the input string and remove duplicates, keeping a count of the number of occurrences of each character. They you can build

Re: [algogeeks] DISTINCT Permutations ( Not Easy)

2014-01-09 Thread bujji jajala
programn :). -Thanks, Bujji On Thu, Jan 9, 2014 at 3:56 AM, bujji jajala jajalabu...@gmail.com wrote: Hi Nishanth Pandey, Excellent solution! It meets all requirements in problem! One thing I am finding hard to understand is your duplicate functions

Re: [algogeeks] DISTINCT Permutations ( Not Easy)

2014-01-08 Thread bujji jajala
*/ return true; return false; } Why are you skipping if you find element you want to swap in between start and end indexes in duplicate function? Please let me know you intuition. -Thanks, Bujji On Tue, Jan 7, 2014 at 6:08 AM, Nishant Pandey nishant.bits.me...@gmail.com wrote

[algogeeks] DISTINCT Permutations ( Not Easy)

2014-01-06 Thread bujji jajala
should generate n! / ( n_1! * n_2! * * n_m! ) strings. Ex: aba is given string Output: aab aba baa -Thanks, Bujji -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send

[algogeeks] DISTINCT Permutations ( Not Easy)

2014-01-06 Thread bujji jajala
should generate n! / ( n_1! * n_2! * * n_m! ) strings. Ex: aba is given string Output: aab aba baa -Thanks, Bujji -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send

[algogeeks] DISTINCT Permutations with possible repeated characters

2014-01-06 Thread bujji jajala
Output: aab aba baa Ex2: aaa is given input string Output aaa -Thanks, Bujji -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr

Re: [algogeeks] [Algogeeks] Longest increasing sub sequence length in linear time

2013-12-18 Thread bujji jajala
increasing run in a numerical sequence is straightforward. Indeed, you should be able to devise a linear-time algorithm fairly easily. Sorry, After reading it again I see that those should be neighbours. I have interpreted longest increasing run wrongly. -Thanks, Bujji. On Tue, Dec 17, 2013 at 1:17 PM

[algogeeks] [Algogeeks] Longest increasing sub sequence length in linear time

2013-12-16 Thread bujji jajala
Given an Array of integers (A1,A2,...,An) of length n, Find the maximum possible length of increasing sub sequence formed from A1, A2,,An. I read that it is possible to compute in linear time as mentioned in algorithm design manual bySkiena. -Thanks Bujji -- You received this message

[algogeeks] Re: Modify Queue Data Structure which returns min in O(1) time.

2010-10-18 Thread bujji
Can you please explain your Algorithm to implement queue using stack in O(1) time? On Oct 18, 1:43 pm, juver++ avpostni...@gmail.com wrote: The amortized time is O(1) for extracting and pushing elements from/in the queue. On 18 ÏËÔ, 12:01, Mallesh Kavuluri mallesh...@gmail.com wrote:

Re: [algogeeks] Re: Modify Queue Data Structure which returns min in O(1) time.

2010-10-18 Thread bujji jajala
...@gmail.com wrote: Please refer to the following link for the explanation: http://stackoverflow.com/questions/69192/using-stack-as-queue On 18 окт, 14:06, bujji jajalabu...@gmail.com wrote: Can you please explain your Algorithm to implement queue using stack in O(1) time? On Oct 18, 1:43 pm

[algogeeks] Re: number of BST's

2010-08-02 Thread bujji
Number of BST with n keysf(n) = [ \sum_{ i=1 to n} f(i-1)* f(n- i) ] Root node can be any of n keys. if it is ith ney in ascending order, it has i-1 keys to left and n-i keys to right. Can any one explain how/Why is it equal to catalan number? -Thanks Bujji On Aug 1, 1:08 pm, Manjunath

[algogeeks] Re: algorithm

2010-08-02 Thread bujji
@Anand, It looks like your algorithm takes O(log N ) time. Repeatedly choosing one half or the other half. Similar to binary search. Please correct me if I am worng. -Thanks and regards, Bujji. On Jul 27, 12:29 am, Anand anandut2...@gmail.com wrote: * * *Using partition

[algogeeks] Re: algorithm

2010-08-02 Thread bujji
Median can be computed in O(1) time after the element is inserted into existing DS. But inserting a new element in to the AVL takes O(log n) time. Overall it takes O(log n) time including inserting new element and median computation. Can median be computed in O(1) time on the fly? On Jul 28,

[algogeeks] Re: Permutation.................

2010-08-02 Thread bujji
, Bujji On Aug 1, 4:00 pm, UMESH KUMAR kumar.umesh...@gmail.com wrote:  Write a C  code for generate all possible Permutation  as:- 1 2 3 Total no. of Per=6 also print all permutation as:- 1 2 3        1 3 2         2 1 3        2 3 1        3 1 2       3 2 1 if inpute is 1 2 3 2

[algogeeks] Re: Adobe Strings matching Puzzle.

2010-07-27 Thread bujji
Hi Anand, Can you please explain your code? What is the magic number 10 in if(k == 10) { printf(String Matched\n); } in your code? What does while loop do in your code? Can you please write a comment? -Thanks in advance, Bujji #include stdio.h #include