[algogeeks] Re: Binary Tree Amazon

2011-02-15 Thread Jammy
hash would be a perfect choice. I make a MinMaxHash class which would keep track of the min and max value of the key.(since in this case we would never remove a key, thus this primitive approach works. Otherwise use treeMap) class MinMaxHash extends HashMap{ private Integer min = Integer.MAX_

Re: [algogeeks] Re: interview quest..

2011-02-15 Thread sahil gujral
stack for sure.. pop out the enteries till they r same and push this entry back once. On Wed, Feb 16, 2011 at 11:18 AM, jalaj jaiswal wrote: > can any1 tell me the question .. m gettin half of the post ,... > > On Wed, Feb 16, 2011 at 10:41 AM, Jammy wrote: > >> @Abhijit. Does your code takes O

Re: [algogeeks] Re: interview quest..

2011-02-15 Thread jalaj jaiswal
can any1 tell me the question .. m gettin half of the post ,... On Wed, Feb 16, 2011 at 10:41 AM, Jammy wrote: > @Abhijit. Does your code takes O(N^2)? I think the following code > would do it in O(N) > > iterate the string once: > > void remove(char *a){ >if(!a){ >

[algogeeks] Re: interview quest..

2011-02-15 Thread Jammy
@Abhijit. Does your code takes O(N^2)? I think the following code would do it in O(N) iterate the string once: void remove(char *a){ if(!a){ int i = 0, j = 1; while(a[j]!='\0'){ if(i<0 || a[i]!=a[j]){

Re: [algogeeks] GOOG: Design a circular buffer and write the code for the reader and writer routines

2011-02-15 Thread pacific pacific
here is my approach. shared variables : in, out shared memory : buf[N] writer while(1) { while(in+1 % N ==out) { // waiting } buf[in+1]= input; in = in+1 % N } reader while(1) { while(out == in) { // waiting } output = buf[out] out = out+1 % N } On Tue, Feb

Re: [algogeeks] Re: question at K10

2011-02-15 Thread Balaji S
The solution is.. _AX = 10; can anyone explain?? -- 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...@googl

Re: [algogeeks] Re: question at K10

2011-02-15 Thread SUDHIR MISHRA
nice solution -- 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 more opt

Re: [algogeeks] Re: question at K10

2011-02-15 Thread jagannath prasad das
void change() { #define i i=10,n } this will do.. On Tue, Feb 15, 2011 at 11:33 PM, Rel Guzman Apaza wrote: > Nothing... 10 in base 5 = 5 in base 10. > > void change(){ > printf(""); //...? > } > > 2011/2/15 Don > > A semicolon is valid in the middle of a line in C or C++. >> >> For i

[algogeeks] Invitation for Online programming competition DOPE

2011-02-15 Thread pankaj do it
Hello, we like to invite you all to participate in Online Programming Contest organized as a part of Daksh 2011, an international level Technical festival of SASTRA University, Thanjavur, Tamilnadu We have two competitions: 1) DOPE Dope is a 6 hour ACM ICPC style algorithmic competition with team

Re: [algogeeks] Re: question at K10

2011-02-15 Thread Rel Guzman Apaza
Nothing... 10 in base 5 = 5 in base 10. void change(){ printf(""); //...? } 2011/2/15 Don > A semicolon is valid in the middle of a line in C or C++. > > For instance, no one says that > > for(i = 0; i < 10; ++i) > > is three lines of code. > > Don > > On Feb 15, 11:31 am, jalaj jaiswal

[algogeeks] Re: Help

2011-02-15 Thread Don
Mike Johnson wrote: > Plesae rite a program for me to find prime nummers. It should be recursive > prorgram. What duz that mean? > If u type a nummer like 10 it should say "1 is prime, 2 is prime, 3 is prime, > 4 is not prime" up to 10. > This iz not homewurk I just thout of it myself. Lol. /* S

[algogeeks] Re: question at K10

2011-02-15 Thread Don
A semicolon is valid in the middle of a line in C or C++. For instance, no one says that for(i = 0; i < 10; ++i) is three lines of code. Don On Feb 15, 11:31 am, jalaj jaiswal wrote: > after termination of semicolon , that will be considered a separate line i > guess > > > > On Tue, Feb 15, 2

Re: [algogeeks] Re: question at K10

2011-02-15 Thread jalaj jaiswal
after termination of semicolon , that will be considered a separate line i guess On Tue, Feb 15, 2011 at 10:59 PM, Don wrote: > void change() > { > printf("10"); while(1) {} > } > > On Feb 15, 10:17 am, Balaji S wrote: > > Insert only one line in the function change() so that the output of the

[algogeeks] Re: question at K10

2011-02-15 Thread Don
void change() { printf("10"); while(1) {} } On Feb 15, 10:17 am, Balaji S wrote: > Insert only one line in the function change() so that the output of the > program is 10. > You are not allowed to use exit(). You are not allowed to edit the function > main() or to > pass the parameter to change

Re: [algogeeks] Byte or Bite...Its byte Array

2011-02-15 Thread jalaj jaiswal
give an example as what to do .. tha language of the question is not clear to me On Tue, Feb 15, 2011 at 5:32 PM, bittu wrote: > Given a byte array, in which characters can be 1 byte or 2 bytes long > > For 1-byte characters, the Most significant bit must be 0. For a 2- > byte character, the mos

[algogeeks] GOOG: Design a circular buffer and write the code for the reader and writer routines

2011-02-15 Thread Ashish Goel
as i see this would need synchronization... anyone tried it so far? Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send em

[algogeeks] question at K10

2011-02-15 Thread Balaji S
Insert only one line in the function change() so that the output of the program is 10. You are not allowed to use exit(). You are not allowed to edit the function main() or to pass the parameter to change() void change() { // Code here } int main() { int i=5; change(); printf(“%d” ,i); return 0;

[algogeeks] MS : Design an expensive clock for 4-7 year olds

2011-02-15 Thread Ashish Goel
the idea is to check how far the imagination can go Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algog

[algogeeks] Byte or Bite...Its byte Array

2011-02-15 Thread bittu
Given a byte array, in which characters can be 1 byte or 2 bytes long For 1-byte characters, the Most significant bit must be 0. For a 2- byte character, the most significant bit of the most significant byte must be one and the most significant bit of the least significant byte is don’t care (X).

Re: [algogeeks] Re: SPOJ problem code:MAJOR

2011-02-15 Thread Balaji Ramani
@Akshata I managed to get AC with majority algorithm. suggestions: 1) You can try to read input and find candidate in same loop 2) Use scanf and printf Thanks, Balaji. On Tue, Feb 15, 2011 at 4:30 PM, jai gupta wrote: > #include > #include > #include > void work() { > int n,max,maxpos,x,

Re: [algogeeks] Re: SPOJ problem code:MAJOR

2011-02-15 Thread jai gupta
#include #include #include void work() { int n,max,maxpos,x,i; scanf("%d",&n); int *arr=(int*) malloc(sizeof(int)*2005); memset(arr,0,2005); max=maxpos=0; for(i=0;imax) { max=arr[x+1000]; maxpos=x; } } if(max>n/2) print

[algogeeks] Call for Papers: The 2011 International Conference on Computer Graphics and Virtual Reality (CGVR'11), USA, July 18-21, 2011

2011-02-15 Thread A. M. G. Solo
   CALL  FOR  PAPERS      and   Call For Workshop/Session Proposals       CGVR'11 The 2011 International Conference on Computer Graphics   and Virtual Reality       Date and Location: Ju

Re: [algogeeks] What is the error in the following function

2011-02-15 Thread dinesh bansal
got it clear.. thanks guys. On Tue, Feb 15, 2011 at 1:46 PM, jagannath prasad das wrote: > here start is pointing to string constant which is created in read-only > memory which can't be changed.so modifying it in the for loop causes > segmentation fault > declare it as a array type > > > On Tue,

[algogeeks] SUDHIR MISHRA wants to chat

2011-02-15 Thread SUDHIR MISHRA
--- SUDHIR MISHRA wants to stay in better touch using some of Google's coolest new products. If you already have Gmail or Google Talk, visit: http://mail.google.com/mail/b-62d5befb93-3fceb99bf3-oYX-pec-NCYCzMLIBV7yRJ6EMUI You'll

[algogeeks] Invitation to Bytecode 2011

2011-02-15 Thread suhash
Hi all, I would like to invite you all to participate in Bytecode 2011, a 6-hour ACM ICPC style algorithm intensive online programming competition. Bytecode is organized as a part of Pragyan 2011, the International Level Techno-Managerial Festival of National Institute of Technology, Tiruchirap

Re: [algogeeks] What is the error in the following function

2011-02-15 Thread jagannath prasad das
here start is pointing to string constant which is created in read-only memory which can't be changed.so modifying it in the for loop causes segmentation fault declare it as a array type On Tue, Feb 15, 2011 at 12:36 PM, rahul wrote: > char *start is const char *start, pointer to const char, u c