Re: [algogeeks] Re: first larger element in unsorted array...

2011-02-01 Thread abc abc
Guys please check correctness of your algorithm before posting On Mon, Jan 31, 2011 at 11:47 PM, ritu ritugarg.c...@gmail.com wrote: @Ralph Build a data structure on array B[1..n] in O(n) time such that the following problem can be solved in O(log n) time: Given an index i and value

Re: [algogeeks] Re: Amazon Written Tes Q1

2011-02-01 Thread abc abc
@sankalp how will you solve using count sort . I would like to have your solution :) On Mon, Jan 31, 2011 at 6:53 PM, sankalp srivastava richi.sankalp1...@gmail.com wrote: @manoj the great recursion problem has the time complexity as tn=2(T(n/2))+O(1) . It is not linear . ur algo is O(nlog

[algogeeks] Invitation for CodeCracker'11 , Online Coding Competition

2011-02-01 Thread Navin Agarwal
Hi all, It is with immense pleasure that we announce CodeCracker '11http://codecracker.in/scheduled during Mukti http://mkti.in/, The Annual FOSS Symposium of NIT Durgapur, India. The Programming Contest is scheduled on February 2, 2011 at 22:00-00:30

Re: [algogeeks] Maximize the Time to see TV

2011-02-01 Thread Vikas Kumar
@Snehal just a hint: there is no need of that channel 1 channel 2. just treat each program as independent program. On Mon, Jan 31, 2011 at 10:44 PM, snehal jain learner@gmail.com wrote: or provide some link On Mon, Jan 31, 2011 at 10:44 PM, snehal jain learner@gmail.comwrote: @

[algogeeks] Re: Invitation for CodeCracker'11 , Online Coding Competition

2011-02-01 Thread Veenus Gupta
hey , pass-out students are allowed in this competition On Feb 1, 1:18 pm, Navin Agarwal navin0...@gmail.com wrote: Hi all, It is with immense pleasure that we announce CodeCracker '11http://codecracker.in/scheduled during Mukti http://mkti.in/, The Annual FOSS Symposium of NIT Durgapur,

[algogeeks] Re: first larger element in unsorted array...

2011-02-01 Thread Veenus Gupta
#define N 7 int main() { int a[N]={1,3,5,7,6,4,8}; int m[N]; m[N-1]=-1; for(int i=N-2;i=0;i--) { if(a[i]=a[i+1]) m[i]=a[i+1]; else m[i]=m[i+1]; } for(int

[algogeeks] Re: Frequently one of the Top Question Asked in Amazon

2011-02-01 Thread bittu
OK Guys problem i Solved ...Let me explain the problem.. 1. First of all its not problem of converting BST to Sorted Doubly Linked List also 2. Not To just Converting BT to DLL 3 .Problem is Neither to Just print The Spiral Order Traversal of BT Please Read the problem Carefully Before

[algogeeks] Excel Sheet Question Asked

2011-02-01 Thread bittu
Given a series A,B,C ...Z, AA, AB,AC,ADAZ,BA,BB...BZ,CA (Open excel sheet. The names of column represent the series). Given input as number 'n'. Output the 'n' th string of the series. also vice versa if given string prints its corresponding string...e.g given AC then its integer is

Re: [algogeeks] Re: Amazon Again

2011-02-01 Thread nishaanth
nice solution.. On Sun, Jan 30, 2011 at 11:51 PM, Wei.QI qiw...@gmail.com wrote: here is the code: public int findStartPumpIndex(int[][] pumpDistance){ int leftGas = 0; int start = 0; //Find the potential start for(int i=0; ipumpDistance.length; i++){ int addGas =

[algogeeks] minimum no. of clicks

2011-02-01 Thread snehal jain
You are given an array A of length N. You have to destroy it, given that you have the power to remove any continuous chunk of same numbers with 1 click. Thus the order in which you remove chunk matters. For example given {1, 2, 3, 1} normally it will take you 4 clicks to remove but if you first

Re: [algogeeks] Re: Invitation for CodeCracker'11 , Online Coding Competition

2011-02-01 Thread Navin Agarwal
@veenus : The contest is open to everyone, but only students are eligible for prizes. -- Navin Agarwal -- 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

[algogeeks] Re: first larger element in unsorted array...

2011-02-01 Thread SVIX
@abc- i'm afraid u wont find this level of participation if that were the case... ppl post the solution they think works... On Feb 1, 12:06 am, abc abc may.i.answ...@gmail.com wrote: Guys please check correctness of your algorithm before posting On Mon, Jan 31, 2011 at 11:47 PM, ritu

Re: [algogeeks] Re: first larger element in unsorted array...

2011-02-01 Thread Aman Goyal
this code will work only for this test case, it is wrong for all cases...eg3 4 9 8 6 7 10 there will be -1 output for 8 and 9 which is actually wrong.. On Tue, Feb 1, 2011 at 6:01 PM, Veenus Gupta smartvee...@gmail.com wrote: #define N 7 int main() { int a[N]={1,3,5,7,6,4,8};

Re: [algogeeks] Re: first larger element in unsorted array...

2011-02-01 Thread Aman Goyal
we can create a height balanced tree with all nodes having their value and also their index value.. can be done in o(n) then we need to look to d right side of the node and check for index(greater ).. which will be o(log(n)) correct me if i m wrong.. On Tue, Feb 1, 2011 at 7:50 PM, Aman Goyal

[algogeeks] Re: google questions

2011-02-01 Thread bittu
Well its good Question Instead of Googling I would like to give some naive approach for this.. which pays from time space 1st Counts the number or words in single large file for this we can process this like while (in.get(ch)) //as we read character by character from file { if (

Re: [algogeeks] Re: first larger element in unsorted array...

2011-02-01 Thread nishaanth
@Balaji.nice solution..but care to explain how it is applied in the other 2 problems you mentioned at the end(Rectangle in a histogram and largest rectangle in the binary matrix ..) On Mon, Jan 31, 2011 at 2:21 PM, Balaji Ramani rbalaji.psgt...@gmail.comwrote: Hi, This can be solved the

Re: [algogeeks] can i know the best way to learn programming??

2011-02-01 Thread nishaanth
solve problems from SPOJ and topcoder.it helps a lot. On Tue, Feb 1, 2011 at 1:30 AM, sandy sandeep.aa...@gmail.com wrote: plz help -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Excel Sheet Question Asked

2011-02-01 Thread albert theboss
Simply L division by 26 gives the answer ... like decimal to binary conversion thats it -- 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

Re: [algogeeks] Excel Sheet Question Asked

2011-02-01 Thread Srikar
since the problem uses all 26 letters, we could use a number system with base as 26. 2 operations are - 1) Given number to string - Treat the number as number in base 26. 2) Given string to number. Credit goes here -

[algogeeks] Special Binary Treee....Stuckkk!!!!!

2011-02-01 Thread bittu
Given a Special BT in which Each Non Leaf Node Except Root Has at- least two children .Given Pre-order and Post-order of Tree Your Task is to design the tree From the Given Information.. Thanks Regards Shashank Mani -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Excel Sheet Question Asked

2011-02-01 Thread Wei.QI
@albert, You need to becareful when doing the divide, because there is no ZERO. (Z - AA not Z-A0). here is the code: public static String ExcelMapIntToStr(int n) { StringBuilder sb = new StringBuilder(); while(n0) { sb.append((char)(('A' - 1) + (n-1)%26 + 1)); n = (n-1)/26; } return

[algogeeks] Re: minimum no. of clicks

2011-02-01 Thread bittu
@ its again the question related to the frequency..of number My Approach would be we have to count the no. of time the a particular number occurring in the array then first took the number which has lowest frequency in case of Tie FCFS used up. then proceed to higher frequency number that

Re: [algogeeks] Excel Sheet Question Asked

2011-02-01 Thread albert theboss
yes yes i forgot to say when n is 26 we ll get (26)0 ie A0 so wen u encounter 0 u need to borrow one which ll become 26 for the borrower number from previous number so it ll become 0Z. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

Re: [algogeeks] Re: Amazon Written Tes Q1

2011-02-01 Thread HARISH S.C
n be the minimum value in the list m be the maximum value in the list Have an array C[m-n] Initialize C to zero. now Node *node=head; while(node!=NULL) { C[node-info-n]++; } now using the array C,create a sorted list. Since we are using doubly linked list,we might have some other

Re: [algogeeks] Re: Amazon Written Tes Q1

2011-02-01 Thread HARISH S.C
sorry in above solution add node=node-next in while loop On Wed, Feb 2, 2011 at 1:05 AM, HARISH S.C s.c.har...@gmail.com wrote: n be the minimum value in the list m be the maximum value in the list Have an array C[m-n] Initialize C to zero. now Node *node=head; while(node!=NULL) {

[algogeeks] Microsoft interview question

2011-02-01 Thread HARISH S.C
We have a text editor application where we can choose 1)between 100s of different fonts like arial,calibri,etc.. 2)different text sizes 3) different formatting such as bold, Italics,regular,etc.. Imagine that the application is similar to word(there we will have these options). Now give different

Re: [algogeeks] minimum no. of clicks

2011-02-01 Thread Srikar
Could I sort it? Oh you mentioned that the original array could be destroyed. In that case, 1) Sort the array - O(nlogn) 2) loop through the array. if contiguous elements are same remove all of them in one click else remove only that element. - O(n) Time - O(nlogn) space - O(1) On Tue, Feb

[algogeeks] Re: minimum no. of clicks

2011-02-01 Thread Dave
@Srikar: Isn't it sort of silly to propose an O(n log n) algorithm when just naively clicking on the digits in order gives an O(n) algorithm? Dave On Feb 1, 12:04 pm, Srikar srikar2...@gmail.com wrote: Could I sort it? Oh you mentioned that the original array could be destroyed. In that

[algogeeks] Re: minimum no. of clicks

2011-02-01 Thread Dave
@Bittu: You said to correct you if you are wrong, so here goes. The original problem statement says that you can remove any continuous chunk of the same numbers with one click. Maybe it would have been clearer to use the word contiguous instead of continuous, but since your 4s are not adjacent to

Re: [algogeeks] Special Binary Treee....Stuckkk!!!!!

2011-02-01 Thread Balaji
Hi Shashank, Please find below the psuedocode for constructing the Binary tree from pre and post order traversal. My assumption was that given pre and post order traversal of a tree, binary tree can be constructed of any form. Correct me if I am wrong.. Lets assume the pre and post order

[algogeeks] Re: Special Binary Treee....Stuckkk!!!!!

2011-02-01 Thread Dave
@Bittu: It seems straightforward. Where are you having difficulties? Dave On Feb 1, 12:55 pm, bittu shashank7andr...@gmail.com wrote: Given a Special BT in which Each Non Leaf Node Except Root Has at- least two children .Given Pre-order and Post-order of Tree Your Task is to design the tree

[algogeeks] Re: Microsoft interview question

2011-02-01 Thread Gene
Well, this is a white box test. In a wbt, you look for edge and corner cases. Edge cases in this scenario are the largest and smallest point sizes. The fonts with largest kerning values. Largest ascenders and descenders. Largest number of printable characters. You'd probably concentrate on

Re: [algogeeks] Microsoft interview question

2011-02-01 Thread Sarma Tangirala
How many test cases were you expected to give? I think one problem you will have is rendering a font on different sizes. A generic test case could be, randomly pick a font and format and then alternate between a few extremes of the font size range and check if they look the same. Another kind

[algogeeks] Re: first larger element in unsorted array...

2011-02-01 Thread ritu
@Sankalp range of input is not given ..so count sort can't taken as an option On Jan 31, 6:16 pm, sankalp srivastava richi.sankalp1...@gmail.com wrote: Another approach would be to use a counting sort method (less space efficient though ) So , for space efficiency , we can use a bitset

[algogeeks] Re: first larger element in unsorted array...

2011-02-01 Thread ritu
@Aman can u explain how creation of tree ll take O(n) time also ...what abt nodes not having right child On Feb 1, 7:22 pm, Aman Goyal aman.goya...@gmail.com wrote: we can create a height balanced tree with all nodes having their value and also their index value.. can be done in o(n) then we

Re: [algogeeks] can i know the best way to learn programming??

2011-02-01 Thread Ajay Kumar
@ nishaanthh... what is SPOJ and topcoder...plz help!!! On Tue, Feb 1, 2011 at 9:31 PM, nishaanth nishaant...@gmail.com wrote: solve problems from SPOJ and topcoder.it helps a lot. On Tue, Feb 1, 2011 at 1:30 AM, sandy sandeep.aa...@gmail.com wrote: plz help -- You received this

Re: [algogeeks] Microsoft interview question

2011-02-01 Thread HARISH S.C
@Sarma : He said we should finish testing within 2 days. @Gene: I said the same answer but he said its ok for size but for font it will not work because style of each and every font will differ and he said doing exhaustive test for all fonts is not a solution too. On Wed, Feb 2, 2011 at 7:38 AM,

Re: [algogeeks] Microsoft interview question

2011-02-01 Thread Sarma Tangirala
@guys What's the right answer? Sent from my BlackBerry -Original Message- From: HARISH S.C s.c.har...@gmail.com Sender: algogeeks@googlegroups.com Date: Wed, 2 Feb 2011 13:01:59 To: algogeeks@googlegroups.com Reply-To: algogeeks@googlegroups.com Subject: Re: [algogeeks] Microsoft