[algogeeks] Help need: online Amazon Test

2012-09-07 Thread coolfrog$
any one given Amzon online test recently? Plz share quetions and interview experience. Thanks in advance. -- 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 th

Re: [algogeeks] Re: AMAZON: given col id, print col name in excel

2012-08-19 Thread coolfrog$
@shiva: Nice thinking, man... :) @Yq Zhang: this similar to base 26 apporch, i have tested below code for boundary cases , 0, 26(z), 27(aa), 26*26(yz), 26*27(zz) public String getColName(int id) { char ch[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',

Re: [algogeeks] is given number is lucky..?

2012-08-18 Thread coolfrog$
@vivek ur code is give true for 5 The first few numbers of series are 3, 7, 13, 31, 37, 43, 67, 73, 79, 127, 151, 163, 193. On Mon, Aug 13, 2012 at 10:15 AM, vivek rungta wrote: > bool is_lucky(int x){ > int pos=x; > inr count=2; > while(count if(pos%count) > return 0; > pos=pos-pos/cou

Re: [algogeeks] Re: Microsoft Interview Question

2012-07-03 Thread coolfrog$
@All *Here is the working code: test on input {-1,5,3,-8,4,-6,9} and {1,-1,2}* Algo: increment current till first +ve number(p) and decerement end till last -ve number(n) now consider only array between [p..n] If current is negetive, increment current If current is positive, swap it with end and

Re: [algogeeks] thanx...

2011-08-20 Thread coolfrog$
congrats..:) and do share you experience.. On Sat, Aug 20, 2011 at 10:16 AM, ankur pratik wrote: > thanx to all members of algo geeks... i got a job... this goup is > awesome for any discussion > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks"

Re: [algogeeks] amazon help

2011-08-11 Thread coolfrog$
@all can some plz suggest the source for where i can fine the dates and news regarding amazon off-campus Placements. On Fri, Aug 12, 2011 at 6:36 AM, Akash Mukherjee wrote: > Hi, > > Can anyone suggest from where I should practice for the online coding round > for amazon off-campus placements.

Re: [algogeeks] Microsoft

2011-02-06 Thread coolfrog$
@Decipher Microsoft is coming in over college.. can you Give some more question which are recently asked ...in MS test... @everone.. do share question of MS if some body has given the recently this Test.. Algorithm: 1. maintain min_diff so far 2. maintain max_element so far complexity is O(n) , a

Re: [algogeeks] Re: Longest increasing subsequence

2011-01-03 Thread coolfrog$
@anand http://anandtechblog.blogspot.com/2010/07/longest-increasing-subsequence.html there is problem with your blog... plz check it . its very nice.. and very informative... but it no opening check it plz... On Fri, Dec 31, 2010 at 10:18 PM, Anand wrote: > @Nikhil, > > I searched through th

Re: [algogeeks] arrays

2011-01-01 Thread coolfrog$
yes O(n) solution posible.. 1. traverse the first array.. 2. for(i=1;i<=n;i++) { X[a[i]] = i ; } 3. print array X[]; On Sat, Jan 1, 2011 at 10:42 PM, Soumya Prasad Ukil wrote: > Is the second array really required, assuming intersection of both A & B is > equal to either A or B? > > How

[algogeeks] SQL Interview quetions ????

2010-12-25 Thread coolfrog$
can some body provide Sql interview Question, for bigger companies like Microsoft , SAP..etc.. Like here on Algogeeks we find all range of Algorithms question... Pls suggest some links for tricky question in SQL.. and Unix(basics).. thankyou in advance... -- *Divesh* (¨`·.·´¨) Always `·.¸(¨`·.·

Re: [algogeeks] Re: k nearest points

2010-12-05 Thread coolfrog$
@alexsolo what is Kd-tree .. plz explain a little bit you algorithm... On Sun, Dec 5, 2010 at 7:28 PM, alexsolo wrote: > use kd-tree > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@goog

Re: [algogeeks] Re: k nearest points

2010-12-05 Thread coolfrog$
@jai gupta how can you find solution in O(n) in O(n) you can just find the distance of all the points form origin.. then find the k smallest numbers(distance) in O(k log n + n ) using heap short.. On Sun, Dec 5, 2010 at 7:28 PM, alexsolo wrote: > use kd-tree > > -- > You received this message

Re: [algogeeks] Re: Amazon Interview Question

2010-12-05 Thread coolfrog$
@Nikhil run you algo .. on test case index -> 1 2 3 4 5 value -> 1 2 3 4 5 ouput is mid+1= 3+1=4 but it should be 5... correct me if i am wrong... and u have assumed all are positive, hence base index should be 1 On Sun, Dec 5, 2010 at 4:41 PM, Nikhil Agarwal wrote: > If All the elements are un

Re: [algogeeks] Microsoft interview question

2010-12-04 Thread coolfrog$
@shreyas VA you are using O(n) extra space... On Sat, Dec 4, 2010 at 8:46 PM, Shreyas VA wrote: > Given the size of the input array, > construct array1 = {0, 1, 0, 1} till n elements > > traverse through input array checking sum of 1's n 0's. > > at the end if both sums are equal return a

Re: [algogeeks] Microsoft interview question

2010-12-04 Thread coolfrog$
here base index is 1 and total no. of elements are n. k=1; i=1; while(i wrote: > I hope the following approach will work. > Let 'a' be the input array with size n. > > int i = 0, j = 1; > > while( true) > { > while( i < n && a[i] == 0) i += 2; > while( j < n && a[j] ==

Re: [algogeeks] Re: Swap the LSB and MSB within themself of given no.

2010-11-22 Thread coolfrog$
@dave plz run gene's code for input 0xAD...or send me some link of bitwise programing which involve simultaneous many opearation... like above... i am always confused with bitwise programing... On Sun, Nov 21, 2010 at 11:11 PM, Dave wrote: > @Coolfrog$: Don't forget the bi

Re: [algogeeks] Re: Swap the LSB and MSB within themself of given no.

2010-11-21 Thread coolfrog$
@gene plz explain .. what is going on... by taking example. i am unable to run a test case 1. x=0xAD (1010 1101) 2. x<<1 ===>01011010 | x>>1 >01010110 x =0100 how we will get answer as ( 0101 1011).?? On Sun, Nov 21, 2010 at 9:59 AM, Gene

Re: [algogeeks] Swap the LSB and MSB within themself of given no.

2010-11-20 Thread coolfrog$
Divesh Dixt sorry last output should be 0xEC... On Sun, Nov 21, 2010 at 9:11 AM, Divesh Dixit < dixit.coolfrog.div...@gmail.com> wrote: > assuming all are 8bit no. > input = 0x46 (0100 0110) > output = 0x26 ( 0010 0110 ) > input = 0x75 (0111 0101) > output = 0xFC (1110 1010 ) > > Algorithm

Re: [algogeeks] Placement

2010-11-18 Thread coolfrog$
@Mukesh indiabix.com is really a nice on for place ment... thankyou.. keep posting such linking On Wed, Nov 17, 2010 at 9:53 AM, Mukesh Kumar thakur < mukeshraj8...@gmail.com> wrote: > try website:-.www.placementpapers.com > indiabix.com > > > On 11/15/10, Bittu B wr

Re: [algogeeks] Re: first unrepeated char

2010-10-31 Thread coolfrog$
we can reduce space complexity further more by just maintaining one array... a[256]={0,0,0,0,0,0,0,0,0}; As character can be non numeric... all possibility in 256 .. s[] = input string. for( i=0;i 1) return s[i] ; } On Thu, Oct 14, 2010 at 12:42 A

Re: [algogeeks] Re: Smallest window of K[] in N[]. Best order solution

2010-10-31 Thread coolfrog$
@sourav can O(n) solution possible like this n=1245120124587412112544735685458545512522524554745669698784552 k=362541245 1. pivot = n[i] where n[i++]=k[j++] for the first time. 2.while(j<= length of k[] and i<= length of n[]) {if (n[i]==k[j]) { j++;i++;

Re: [algogeeks] Re: google

2010-10-17 Thread coolfrog$
@Dave yes im also trying to say the same point as Gene these problem is similar to "*Least fare for a return trip Algorithm*" where u have suggest the exactly same algorithm.. @Gene do see these similar problem "[algogeeks] Least fare for a return trip Algorithm" here we have

Re: [algogeeks] Re: Least fare for a return trip Algorithm

2010-10-16 Thread coolfrog$
wrong.. don't be annoyed plz thankyou in advance... take care.. On Sat, Oct 16, 2010 at 6:21 PM, Dave wrote: > @Coolfrog$: > > 1. No. It should be O(n + k log k) because finding the kth smallest > element of an array of size n is O(n), using the Median of Medians > a

Re: [algogeeks] Re: Least fare for a return trip Algorithm

2010-10-16 Thread coolfrog$
of step ii in to consideration along with a1+b3,a3+b1,a2+b3,a3+b2 ... On Fri, Oct 15, 2010 at 8:20 PM, Dave wrote: > @Coolfrog$: You don't have to sort the arrays. You only have to find > the k smallest elements in each and sort those k entries. This can be > done

Re: [algogeeks] Re: Least fare for a return trip Algorithm

2010-10-15 Thread coolfrog$
@amod as given A->B andB->A are in sorted form...if not sort them in O(n log n). then first suggestion A1+B1 second suggestion MIN( A1+B2 , B1+A2) ===> let it be B1+A2 third suggestion MIN( A1+B2 , A1+B3, A3+B1,A2+B3, A3+B2)> let it be A2+B3 and so on... @Dave what

Re: [algogeeks] Re: All numbers in Array repeat twice except two

2010-10-05 Thread coolfrog$
@Dave @Mukesh yaa got it... so simple... i was needlessly making it complex thankyou guys . On Tue, Oct 5, 2010 at 2:09 AM, Dave wrote: > @Coolfrog$: It sounds like you think there are n items in each list, > but the problem statement says that the total number of items in the &

Re: [algogeeks] Re: All numbers in Array repeat twice except two

2010-10-04 Thread coolfrog$
ement in the input sequences" but there are k sequence... so the loop must run for *k*(n-1) and each iteration of for loop running cost to O(log k). overall complexity can be O(k(n-1)log k).. plz do correct me Dave thanks.. On Mon, Oct 4, 2010 at 11:20 PM, Dave wrote:

Re: [algogeeks] Re: All numbers in Array repeat twice except two

2010-10-04 Thread coolfrog$
@Dave 1. if three sequence given are 2,3,4,5 17,20,31,50 6,9,10,15 while running we will get 2,3,4,5 as sequence no.1 vanishes form where to choose next element. for heap . (algo.??) 2. Loop until

Re: [algogeeks]

2010-09-30 Thread coolfrog$
Similar to majority voting problem... Assume there exits a majority element As only one such element is possible... Algo:A[1..n] int Major(A[1..n]){ Majority=a[1]; count=1; for(i=2;i<=n;i++) { if(majority ==a[i]) count++; else { if(count==0) { m

Re: [algogeeks] Re: do this: two numbers with min diff

2010-09-28 Thread coolfrog$
@ sorurav yes , the basic logic is required so that the code can be understood in single Run.. i also request the same to all dear friends. Regards.. On Tue, Sep 28, 2010 at 8:11 PM, sourav wrote: > Hi Friends > > This is an interesting problem and request you all to give a brief > i

Re: [algogeeks] Re: Bitwise operator - Adobe

2010-09-25 Thread coolfrog$
@Dave very nice one line solution.. we all are revolving around x>>3 concept... On Sat, Sep 25, 2010 at 10:17 PM, Dave wrote: > answer = (x || 7) + 1; > > Dave > > On Sep 25, 6:56 am, Krunal Modi wrote: > > Q: Write an algorithm to compute the next multiple of 8 for a given > > positive i

Re: [algogeeks] ReVerse a string using recursion

2010-09-23 Thread coolfrog$
t; char *s; > s=(char *)malloc(sizeof(s)); > gets(s); > xstrrev(s,0,strlen(s)-1); > puts(s); > return 0; > } > > > On Fri, Sep 24, 2010 at 12:15 AM, coolfrog$ < > dixit.coolfrog.div...@gmail.com> wrote: > >> @nishant: >> what i

Re: [algogeeks] ReVerse a string using recursion

2010-09-23 Thread coolfrog$
@nishant: what is i and j..??? @ On Thu, Sep 23, 2010 at 1:20 PM, Nishant Agarwal < nishant.agarwa...@gmail.com> wrote: > void xstrrev(char *s , int i , int j) > { > char t; > if(i { > t=s[i]; > s[i]=s[j]; > s[j]=t; > xstrrev(s,i+1,j-1); > > } > } >

Re: [algogeeks] ReVerse a string using recursion

2010-09-23 Thread coolfrog$
|s>temp2) {return;} *temp = *s; *s=* temp2; *temp2=*temp; temp2++; s++; strrev(*s,*temp2) } On Thu, Sep 23, 2010 at 1:15 PM, coolfrog$ wrote: > char* temp, temp2; > char* s="Nitin"; > for(temp2=s;*temp2='\0';temp2++ );/*just to calc

Re: [algogeeks] ReVerse a string using recursion

2010-09-23 Thread coolfrog$
char* temp, temp2; char* s="Nitin"; for(temp2=s;*temp2='\0';temp2++ );/*just to calculate the length of s*/ void strrev(char * s,char* temp2) { if (s==temp2 ||s>temp2) {return;} *temp = *s; *s=* temp2; *temp2=*temp; temp2++; s++; strrev(*s,*temp2) } But it

Re: [algogeeks] Print 1 to n one per each line on the standard output

2010-09-23 Thread coolfrog$
@aswath : nice solution... very simple too. it gives the desired solution as required..though it is a case of indirect recursion... but still a nice aproach... keep it up thanks. Regards Divesh On Thu, Sep 23, 2010 at 12:45 PM, aswath G B wrote: > #include > void f1(int); > void f2(

Re: [algogeeks] Adobe Question

2010-09-23 Thread coolfrog$
@nishaanth for n=1 N=0 as k=1 and k wrote: > @Davefor n=2 ur formulae would give 1 but the result is 3 > > > On Thu, Sep 23, 2010 at 6:53 PM, Apoorve Mohan wrote: > >> what is the data type of 'j' ? >> >> >> On Thu, Sep 23, 2010 at 6:49 PM, Krunal Modi wrote: >> >>> for(k=1 ; k>> j=k; >>> wh

Re: [algogeeks] Re: sum of primes

2010-09-23 Thread coolfrog$
@Dave what is the complexity of this algorithm... it given *O*(*n*(log*n*)(loglog *n*)) but i think it should be O(n^2) On Thu, Sep 23, 2010 at 10:39 AM, Dave wrote: > Following up to my own posting... Sorry. I answered the wrong > question, "What is the sum of the first 10,000 primes?" > >

Re: [algogeeks] Re: Print 1 to n one per each line on the standard output

2010-09-23 Thread coolfrog$
@Greed in windows.. output is infinite loop and printing... 0 0 0 0 0 ... infinite loop.. On Thu, Sep 23, 2010 at 9:57 AM, Greed wrote: > You can use setjmp ,longjmp or goto to get desired result. > #include > #include > void print(int v) > { >int i=0; > >jmp_buf env;

Re: [algogeeks] help required...

2010-09-23 Thread coolfrog$
@ umesh kewat suppose A,B,C,D and D is celebrity A,B C,D how would u eliminate one form A,B even if u can ... it will be order of O(n logn) ... Regards ... Divesh On Thu, Sep 23, 2010 at 4:00 AM, umesh kewat wrote: > Use divide and conquer strategy of algorithm by diving in 2-2 g

Re: [algogeeks] help required...

2010-09-23 Thread coolfrog$
@kartheek i am getting. this prudent approach but what is "add what remained to the remainder." suppose u have A,B,C,D and B is celebrity ... if( A knows B) { A is not celb. if( B knows C){} else{ C is not celb. if (C knows B ) { if(

Re: [algogeeks] Re: Adobe Question

2010-09-23 Thread coolfrog$
@ Dave can u explain ur answer...plz.. On Thu, Sep 23, 2010 at 8:55 AM, Dave wrote: > @Krunal: N = n * ceiling(log_2(n)) - 2^ceiling(log_2(n)) + 1, > > where a^b is a to the power b. > > Dave > > On Sep 23, 8:19 am, Krunal Modi wrote: > > for(k=1 ; k > j=k; > > while(j>0){ > >

Re: [algogeeks] Re: ALgo help pls

2010-09-22 Thread coolfrog$
How can more than one element exist of 2n/3 times repeated.. > @dave: can u add that for loop and send as i tried but could not succeed > > On Wed, Sep 22, 2010 at 6:23 PM, coolfrog$ < > dixit.coolfrog.div...@gmail.com> wrote: > >> solution in o(n log n) >> can be (

Re: [algogeeks] Re: ALgo help pls

2010-09-22 Thread coolfrog$
solution in o(n log n) can be ( as if solution exit only one element cam be a majority element in the given array) 1. sort the array in O(nlogn) 2. x = a[2n/3] if(a[0]==x) { if(x== a[(2n/3])+1) return (x) } On Wed, Sep 22, 2010 at 5:53 AM, Dave wrote:

Re: [algogeeks] Re: Unbounded dictionary lookup

2010-09-22 Thread coolfrog$
; > > > What's const? The point of this isn't that it's a difficult prob to > > > solve. Point lies in working with the design to make this close to log > > > n. > > > > > Define what value "const" holds. > > > > > On Sep

[algogeeks] ind out which row has the maximum number of 1's in 2D array

2010-09-21 Thread coolfrog$
There is a 2 dimensional array with each cell containing a 0 or 1 , Design an algorithm to find out which row has the maximum number of 1's , Your algorithm should have O(n2) time and no space complexity. -- You received this message because you are subscribed to the Google Groups "Algorithm Ge

[algogeeks] re:Unbounded dictionary lookup

2010-09-21 Thread coolfrog$
its dictionary means shorted ordered arry. let low = 1; and high= const.(10^const) Boolean isWord(String word) { while(low <= high) { mid = (low+ high)/2; if(word = getWordAt(mid)) return true; if( word > getWordAt(mid))