Re: [algogeeks] java

2013-03-17 Thread manish untwal
@sasi and Sulekhaits Head First Java...which explained these properties to me. :) On Thu, Mar 14, 2013 at 1:28 PM, sasi kumar wrote: > @Manish Well Explained:) > @sulekha Probably you have to read Head First java which is an awesome > book that covers these topics with examples &g

Re: [algogeeks] java

2013-03-12 Thread manish untwal
, visit https://groups.google.com/groups/opt_out. >> >> >> > > > > -- > sulekha metta > B.E computer science > osmania university > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > T

Re: [algogeeks] java

2013-03-12 Thread manish untwal
+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- With regards, Manish kumar untwal Indian Institute of Information Technology Allahabad (2009-2013 batch) -- You received this message because you are subscribed to the Googl

Re: [algogeeks] Adobe Interview Question

2012-12-16 Thread manish untwal
) > MNNIT > blog:geekinessthecoolway.blogspot.com > > > > On Tue, Dec 11, 2012 at 11:23 PM, manish untwal > wrote: > >> i answered with the...system call too..but he said...do it in C >> programming language only don't use...system call here!! >> >&

Re: [algogeeks] Adobe Interview Question

2012-12-11 Thread manish untwal
:geekinessthecoolway.blogspot.com > > > > On Tue, Dec 11, 2012 at 11:02 AM, amrit harry wrote: > >> 1st: >> >> freopen("filename","r",stdin); >> >> while(scanf("%s",str)!=-1) >> { >> printf("%s\n",str);

Re: [algogeeks] Adobe Interview Question

2012-12-11 Thread manish untwal
i think, i replied with the same answer and he was not convinced On Tue, Dec 11, 2012 at 11:02 AM, amrit harry wrote: > 1st: > > freopen("filename","r",stdin); > > while(scanf("%s",str)!=-1) > { > printf("%s\n",str); > } > > &

Re: [algogeeks] Array Problem

2012-12-11 Thread manish untwal
roup. >>>> 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 options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>> >>> -- >>> 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 options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> -- >> >> >> > > -- > > > -- With regards, Manish kumar untwal Indian Institute of Information Technology Allahabad (2009-2013 batch) --

[algogeeks] Adobe Interview Question

2012-12-10 Thread manish untwal
I gave this interview in August this year, two of the question i was not able to answer properly 1) how to print the content of file in C without using the file pointer. 2) count the total number of permutation of a number in order O(n) --

[algogeeks] os question

2012-12-06 Thread manish
Four processes of 1gb,1.2gb,2gb,2gb are there and RAM available is 2gb. We have a time shared system. Which of the following is the most appropriate scheduling algorithm? a. all processes are loaded sequentially 1 by 1 b. load one process at a time and execute processes in RR fashion c. load 1gb

[algogeeks] swap objects without temp variable

2012-11-04 Thread manish
Swapping two objects (not integers/chars),without using temp...? my solution is using xor operation..is that right and ny other solutions ? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://grou

[algogeeks] OS question..

2012-11-04 Thread manish
Q1. If we have infinite memory, then do we still be needing paging? Q2. Given only 8bits registers, you have to find average of 4 bit registers values without using any operation involving 16 bit calculations. -- You received this message because you are subscribed to the Google Groups "Algori

Re: [algogeeks] BST to DLL code: whats wrong with this code........

2012-09-03 Thread manish untwal
gt; insert(&tree,34); > traverse(tree); > bst2ll(&tree); > printf("\n"); > traversell(tree); > printf("\n"); > } > > > should print : 30 34 40 45 50 60 65 70 > but printing: 30 34 40 45 50 60 70 > > > Thank you > S

Re: [algogeeks] DE Shaw written test

2012-08-07 Thread manish patel
t; "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/BrQFNo1PKTIJ. > > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr..

Re: [algogeeks] Microsoft online questions

2012-07-31 Thread manish untwal
subscr...@googlegroups.com. >>> > For more options, visit this group at >>> > http://groups.google.com/group/algogeeks?hl=en. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Algori

Re: [algogeeks] directi paper pattern

2012-07-31 Thread manish untwal
"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 options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. >

Re: [algogeeks] directi paper pattern

2012-07-31 Thread manish untwal
"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 options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- W

Re: [algogeeks] program

2012-07-26 Thread Manish Patidar
20 Thank you, Have a great day !! * With Regards, * * Manish Patidar.* On Thu, Jul 26, 2012 at 11:11 PM, payal gupta wrote: > ans.20 > > > On Thu, Jul 26, 2012 at 11:09 PM, Ali Ahmad Ansari < > ali.ahamad.ans...@gmail.com> wrote:

Re: [algogeeks]

2012-07-26 Thread manish untwal
t;> >> > -- > 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.

Re: [algogeeks] Directi Written Q 2012

2012-07-24 Thread manish untwal
and we don't need the code!! On Tue, Jul 24, 2012 at 10:30 PM, manish untwal wrote: > I think the question is in the written round!!! > > > On Tue, Jul 24, 2012 at 9:11 PM, algo bard wrote: > >> #include >> #define RANGE_START 0 >> #define RANGE_END 100 &g

Re: [algogeeks] Directi Written Q 2012

2012-07-24 Thread manish untwal
Regards >> >> Lomash Goyal >> >> * >> * >> >> >> -- >> 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.

Re: [algogeeks]

2012-02-12 Thread manish patel
ot;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 options, visit this group at > http://groups.google.com/group/algogeeks?hl=en

Re: [algogeeks] Re: algo for number of Hamiltonian (undirected) cycles on the circulant graph C_n(1,2).

2012-01-26 Thread manish patel
o this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- With Regards Manish Patel BTech Comp

Re: [algogeeks] COA Question

2011-11-19 Thread Manish Patidar
Need Help to prepare for SYNTEL interview. plzz send me topics to cover. Thank you in advance, Have a great day !! * With Regards, * * Manish Patidar.* -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to

Re: [algogeeks] Give the logic for it

2011-10-01 Thread Manish Kumar
int median(int arr1[],int arr2[],int N) { if(N==2) { return ((max(arr1[0],arr1[1])+ min(arr2[0],arr2[1]))/2); } int mid=N/2; if(arr1[mid]==arr2[mid]) return arr1[mid]; if(arr1[mid]>arr2[mid]) return median(arr1,arr2+N/2,N-N/2); if(arr1[m

[algogeeks] Microsoft

2011-10-01 Thread Manish Verma
Does microsoft hire off-campus???..if yes, then what is their process???..n what type of questions they ask???...what about google??? actually i've gone through microsoft's collg hiring process.it was closebut hard luck,anyway..so gonna try after 6 months. -- You rece

Re: [algogeeks] amazon ques

2011-09-30 Thread manish kapur
@adi.. he gave a hint that space used should not b of order of range of numbers but should depend on how many numbers are inserted... eg..if range is say 1000...bt u entered only 5 nos ->8,100,202,600,989. u can use space of order 5..and not 1000 -- You received this message because you are subs

Re: [algogeeks] amazon ques

2011-09-30 Thread manish kapur
@somnath...can u pls elaborate... he was looking for an elaborate ans... -- 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

[algogeeks] amazon ques

2011-09-30 Thread manish kapur
u have to perform following tasks in O(1) time 1.)insertion 2.)deletion 3.)searching no range of input numbers is given wat data structure will you use? if u use hashing wat will be the key and value pairs? -- You received this message because you are subscribed to the Google Groups "Algorithm G

Re: [algogeeks] Re: SPOJ PIGBANK Problem

2011-09-30 Thread manish patel
thanks man i got it .. :) On Fri, Sep 30, 2011 at 12:17 AM, Don wrote: > I think that it will fail if the value of the coins can be more than > 50001. > Don > > On Sep 29, 12:35 pm, manish patel wrote: > > http://www.spoj.pl/problems/PIGBANK/ > > > > pleas

[algogeeks] Re: prime factorization algo

2011-09-19 Thread Manish Verma
around 999,999,999 or the link to above pbm is http://www.spoj.pl/problems/CZ_PROB2/ On Sep 19, 11:45 pm, Rahul wrote: > how much big number are You tHINKING > Rahul > > On Mon, Sep 19, 2011 at 2:40 PM, Manish Verma wrote: > > does anybody know the fastest algo for prime

[algogeeks] prime factorization algo

2011-09-19 Thread Manish Verma
does anybody know the fastest algo for prime factorization of a number??? -- 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 algogeek

Re: [algogeeks] Re: subarray wid sum=k

2011-09-13 Thread manish kapur
bt how to modify it for getting sum value= k? -- 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.c

[algogeeks] ACM

2011-09-08 Thread Manish Verma
Hey, anyone preparing for acm-icpc what about discussing acm-icpc questions here what say @shady?? -- 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 t

Re: [algogeeks] Re: subarray wid sum=k

2011-09-02 Thread manish kapur
@ashima..wat will b the complexity of ur algo? -- 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.

Re: [algogeeks] Re: subarray wid sum=k

2011-09-02 Thread manish kapur
@bharatkumar..cn u pls share the algo -- 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

Re: [algogeeks] Re: subarray wid sum=k

2011-09-02 Thread manish kapur
r u sure space used is O(n)? -- 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 opti

Re: [algogeeks] subarray wid sum=k

2011-09-02 Thread manish kapur
u have 2 find a continuous subarray... -- 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] subarray wid sum=k

2011-09-01 Thread manish kapur
given an unsorted array of +ve and -ve elements.find a subarray with sum= k in O(n). you can use some extra space -- 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

Re: [algogeeks] print level by level withoust recursion

2011-08-31 Thread manish kapur
i think hint is mentioned in the ques..there is an extra pointer..u can take it as parent pointer.. On Wed, Aug 31, 2011 at 10:13 PM, Abhishek Yadav wrote: > can we use loops or GOTO statements > > On Wed, Aug 31, 2011 at 10:03 PM, manish kapur > wrote: > >> Given a b

[algogeeks] print level by level withoust recursion

2011-08-31 Thread manish kapur
Given a binary Tree and a node pointer extra in a tree. print all the node level by level. You cannot use any Stack ,recursion and queue. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegro

Re: [algogeeks] microsoft interview

2011-08-31 Thread manish kapur
@anup check ur algo 4 dis.. 0010 -- 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.co

[algogeeks] microsoft interview

2011-08-31 Thread manish kapur
Input is a matrix of size n x m of 0s and 1s. eg: 1 0 0 1 0 0 1 0 0 0 0 0 If a location has 1; make all the elements of that row and column = 1. eg 1 1 1 1 1 1 1 1 1 0 1 1 Solution should be with Time complexity = O(n*m) and O(1) extra space -- You received this message because you are subscr

[algogeeks] Amazon written test ques

2011-08-30 Thread manish kapur
mplement a func node *(char *word){} wich returns a link list of words dat are anagrams with the input word..if no anagrams found return NULL and add that word to the link list given structure of list as struct node { struct node *next; char val[101]; }; -- You received this message because you

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-29 Thread manish patel
om. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > > > -- > Saurabh Singh > B.Tech (Computer Science) >

Re: [algogeeks] c doubt

2011-08-28 Thread manish patel
legroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- With Regards Manish Patel BTech Computer Science And Engineering National Institute

Re: [algogeeks] Apti

2011-08-23 Thread manish patel
mail to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- With Regards Manish Patel BTech 3rd Year Computer Science And

Re: [algogeeks] apti! solve this!

2011-08-17 Thread manish patel
unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- With Regards Manish Patel BTech 3rd Year Computer Science And Engineering National Institute of Technology -A

Re: [algogeeks] Adobe Interview Question

2011-08-15 Thread manish patel
actually here jumping of steps mean it can jump over 1 step at max. like if it is at step no 1 he can jump to 3 as well as 2 but not to 4. Soln is Fibonacci eqn. t(n)=t(n-1)+t(n-2); where t(1)=2 and t(2)=3 On Mon, Aug 15, 2011 at 6:06 PM, Anika Jain wrote: > i m sorry i cant understand the quest

[algogeeks] manish patel wants to chat

2011-08-15 Thread manish patel
--- manish patel 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-e026d3feed-141e1c7d4e-IcnixiONDyPSp9FJaVLNNJRPxVI Y

Re: [algogeeks] array pointer

2011-08-05 Thread Manish Sharma
nsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Manish Kumar Sharma, Undergraduate, Computer Engg. Department., Netaji Subhas Institute of Technology, New Delhi. -- You received this message because you are su

Re: [algogeeks]

2011-07-25 Thread Manish Kumar
suppose the array is arr[]; set index start and end at the starting and ending of the array. sum=arr[start]+arr[end] check if sumvalue decrease end index by one and repeat the process until starthttp://groups.google.com/group/algogeeks?hl=en.

Re: [algogeeks] C ouput

2011-07-23 Thread Manish Kumar
@Akshata: Whenever you increase any variable then it increases according to its type. Here the address of array 'a' is being increased.( &a+1 ). so the address of 'a' will temporarily increased to 20 bytes and then that is assigned to ptr. so ptr is now pointing to any value in the memory just aft

Re: [algogeeks] Re: amazon

2011-07-19 Thread Manish Pathak
gt;> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > Archita Monga > > -- > You received this message because you are subscribed to the Google

Re: [algogeeks] Fwd: MICROSOFT INTERNSHIP (Coding round)

2011-07-18 Thread manish patel
let's start from top right element(call p) if(x=0) { if(arr[i][j]==x) return 1;//found else if(a[i][j]wrote: > > > -- Forwarded message -- > From: sivaviknesh s > Date: Mon, Jul 18, 2011 at 11:29 PM > Subject: Fwd: MICROSOFT INTERNSHIP (Coding round) > To: algogeeks@g

Re: [algogeeks] MICROSOFT

2011-07-17 Thread manish patel
> 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 options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- With Regards Manish Patel BTech 2nd

Re: [algogeeks] Mouse Beer Puzzle

2011-06-28 Thread Manish Pathak
answer is 3 -- Thanks and Regards, Manish Pathak ** TimesJobs.com -- 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] given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread manish kapur
-- 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 options, visit this group at ht

Re: [algogeeks] Re: If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-04-29 Thread Manish Kumar
please send me this book to my email , thanks" manish.iitia...@gmail.com' On Sat, Apr 30, 2011 at 6:07 AM, Venkat wrote: > Hey how's ur interview? > if u have the book pls mail me to " gvr.su...@gmail.com " > > On Apr 19, 6:19 am, nagajyothi gunti > wrote: > > Please send me too at nagajyothi

Re: [algogeeks] A SIMPLE C++ PROGRAM.

2011-04-29 Thread Manish Kumar
here y= 1+ 3+4+4= 12 and x=5 here just follow rules of postfix and prefix operator thanks manish -- 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

Re: [algogeeks] books

2011-04-21 Thread Manish Pathak
roup, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > -- > You received this message because you are subscribed to the Google Groups > "Algorith

Re: [algogeeks] Re: Finding non-repetitive element from an Array with complexity n

2011-04-17 Thread Manish Pathak
10 XOR 11 ---> 01 01 XOR 10 ---> 11(3) So answer is 3. Any query??? -- Thanks and Regards, Manish Pathak ** TimesJobs.com Mo. 9015687266 -- You received this message because you are subscribed to the Google G

Re: [algogeeks] Permutation of a string

2011-04-08 Thread Manish Pathak
#include #include #include int fact(int n); void main() { char a[20],st_char; static int i,j,k,n,ctr,main_ctr; printf("Enter the string : "); //gets(a); scanf("%s",a); n=strlen(a); if(n<=1) { printf("please enter a valid string "); exit(0); } //label : whi

Re: [algogeeks] [brain teaser ] 1april

2011-04-06 Thread Manish Pathak
Hi kamakshi I think, kusum answer's is right, can u explain why A not??? -- Thanks and Regards, Manish Pathak ** TimesJobs.com Mo. 9015687266 *http://manishpathak-mobile.blogspot.com/* -- You received this message because you are subscribed to the Google G

Re: [algogeeks] Re: 28march

2011-04-06 Thread Manish Pathak
'MNNIT ALLAHABAD >> >> The Law of Win says, "Let's not do it your way or my way; let's do it the >> best way." >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" grou

Re: [algogeeks] brain teaser

2011-03-03 Thread Manish Pathak
ooglegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- Thanks and Regards, Manish Pathak ** TimesJobs.com manish.pat...@timesgr

Re: [algogeeks] Amazon Question

2011-03-03 Thread Manish Pathak
group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geek

[algogeeks] MINIMUM POSITIVE SUM

2011-02-09 Thread Manish Verma
Given: An array of integers(may be both positive and negative), we have to find out the minimum positive sum of array(not necessarily continuous). example:- {1,-5,7,10,-14,16,-17,20,21,22} here answer is -5,-17,22 having sum=0; -- You received this message because you are subscribed t

[algogeeks] Re: c programming question

2011-02-05 Thread Manish Verma
... > > > On Sat, Feb 5, 2011 at 7:24 PM, Manish Verma wrote: > > >> answer will depend on your compiler. > > >> On Feb 5, 1:02 am, jagannath prasad das wrote: > >> > *#include > >> > void main(void) > >> > { > >>

[algogeeks] Re: c programming question

2011-02-05 Thread Manish Verma
answer will depend on your compiler. On Feb 5, 1:02 am, jagannath prasad das wrote: > *#include > void main(void) > { > int a=10,b; > b=a++ + ++a; > printf("%d,%d,%d,%d",b,a++,a,++a); > > } > > *what is the answer?how are the function parameters passed on the stack? -- You received this mes

[algogeeks] Please check it out

2010-12-04 Thread Manish Pathak
#include void main() { int a[]={0,1,1,1,1,1,0,0,0,0,0,1},i=0; static int o=0,e=0;//e for no. of 1's in array and o means no. of 0 in array int l=sizeof(a)/4; while(io) //if n0. of 1's greater than no. of 0's then e=o e=o; for(i=0;i<(e*2);i++) { a[i]=i%2; } for(i=e*2;ie) a[i]=0; else if(e>

Re: [algogeeks] google

2010-10-14 Thread Manish K
) . Repeat the above process till u will get first n pairs. Complexity O(n). Thanks Manish On Thu, Oct 14, 2010 at 3:24 PM, arun raghavendar wrote: > Start merging A and B from the tail end for N elements, just like the way > you would do it for a merge sort but with a different constraint

Re: [algogeeks] Re: a google question

2010-07-28 Thread manish bhatia
199 198 197 99 224 221 219 209 203 202 201 200 199 198 197 196 98 224 221 219 209 203 202 201 200 199 198 197 196 manish... From: Varun Nagpal To

Re: [algogeeks] a google question

2010-07-26 Thread manish bhatia
ardrant as (n-2)x(n-3) would leave n-biggest out? What is the criterion to chose the Ist quardrant? manish... From: topojoy biswas To: algogeeks@googlegroups.com Sent: Thu, 22 July, 2010 10:10:58 AM Subject: Re: [algogeeks] a google question im sry the L s

Re: [algogeeks] a google question

2010-07-19 Thread manish bhatia
with largest values. The tricky part is that we need an O(n) algorithm. manish... From: Ashish Goel To: algogeeks@googlegroups.com Sent: Sun, 18 July, 2010 6:31:08 PM Subject: Re: [algogeeks] a google question question please... Best Regards Ashish Goel &

Re: [algogeeks] a google question

2010-07-16 Thread manish bhatia
It doesn't work A => 92 87 81 72 70 61 53 22 18 17 B => 79 78 74 68 64 62 57 34 29 24 C (GOLD) => 171 170 166 166 165 161 160 160 159 156 D (TEST) => 171 170 166 166 165 159 155 155 146 145 Result: FAILED! manish... From: Jite

[algogeeks] Re: Finding the middle of a singly linked list which has a cycle in it

2010-03-29 Thread Manish
@Umer: I guess the last node in the LL is _not_ pointing to the head back. Rather, its pointing to one of the intermediate nodes. That way, N2 or N2.next might not ever be _head_. See example: 1->2->3->4->5->3, where the last node points to the 3rd node in LL. On Mar 29, 9:21 pm, Umer Farooq wr

[algogeeks] Re: Largest span of Increasing Pair in an array

2010-03-22 Thread Manish
This does not look like a solution for the posted problem. This fails the test case {2, 7, 6, 0, 100}, where the answer should have been 4, for k=0 and j=4. Manish On Mar 20, 1:49 pm, saurabh gupta wrote: > This may not be the optimal solution to > " Given an array of integers A[N

[algogeeks] Re: random number...

2009-09-28 Thread manish bhatia
How are you picking ni from [a...b] range (length 7) ? From: avalon To: Algorithm Geeks Sent: Saturday, 19 September, 2009 2:16:47 PM Subject: [algogeeks] Re: random number... Forgive me first if i am wrong since i didn't read all the posting ... Here is a w

[algogeeks] selection from infinite tape

2009-09-17 Thread manish bhatia
There is an infinite tape running, churning out numbers. You are able to see these numbers one by one, but not allowed to store all of them, but you should be ready with k numbers whenever prompted, such that all have been selected with equal probability. Say, when you were prompted, n numbers h

[algogeeks] Re: max product of any three nos in an array of signed integers

2009-09-16 Thread manish bhatia
This one is better than what I suggested before. Doable in O(n)! On Sep 13, 10:10 pm, Dave wrote: > The following assumest that n >= 5. Find the 3 largest positive > numbers and the two largest-in-magnitude negative numbers (i.e., the > two smallest signed numbers). > > If there are not two neg

[algogeeks] Re: max product of any three nos in an array of signed integers

2009-09-16 Thread manish bhatia
1. Sort the array (say arr) (O(nlgn) 2. Find the position of 0 in the array. The left of the array would be all -ve and right of the array is all positive. Say zi is the position of zero, so indices [0, zi) are all -ve and (zi, n-1] are all +ve. (O(lgn). If 0 is not there in the array, we can st

[algogeeks] Re: N number apples needs to distribute across M num baskets of varying capacity in balanced way

2009-09-09 Thread manish bhatia
How about the following, No. of apples = N No. of baskets = M Capacity of baskets = [C1, C2, , Cm] P = capacity utilization = N/(C1 + C2 + ... + Cm) Apples in i'th basket = Ci*P Of course (Ci*P) need not be integeral. Perhaps we can try rounding it to nearest integer and see if their some

[algogeeks] Re: random number...

2009-09-09 Thread manish bhatia
__ From: Dave To: Algorithm Geeks Sent: Wednesday, 9 September, 2009 2:42:26 AM Subject: [algogeeks] Re: random number... Manish, your first approach doesn't work. You will notice that b1, b2, and b3 each are 0 2/5 of the time and 1 3/5 of the time, so the return va

[algogeeks] Re: n balls having k colors

2009-09-08 Thread manish bhatia
8, 2009 at 8:35 PM, manish bhatia wrote: Assign 0 to K numbers to all K colors, such that color -> color_tag (a number b/w [0,K-1]). >code[k] = {0,2,..,k-1} >foreach (permutation from all possible-permuations of code[]) >    sort balls[] on the basis of code

[algogeeks] Re: linked list questions

2009-09-08 Thread manish bhatia
Are we able to store the incoming characters? On Tue, Sep 8, 2009 at 11:51 AM, Bharath wrote: >Slightly modifying first question. > >Check whether a string is palindrome in single pass. > >Meaning an online algorithm is required, i.e. it must be able to read >one character at a time from a stre

[algogeeks] Re: random number...

2009-09-08 Thread manish bhatia
I can think of 2 appraches. [1] Similar to something already suggested. Just adding my 2 cents. 1 to 7 digits can be represented by 3 bits. So going by that, int rand_1_7() {  b1 = rand_1_5()*(7/5) > (7/2) ? 1 : 0; b2 = rand_1_5()*(7/5) > (7/2) ? 1 : 0; b3 = rand_1_5()*(7/5) > (7/2

[algogeeks] Re: find triangle in a graph

2009-09-08 Thread manish bhatia
how about finding all the connected-components and checking which all have 3 edges? From: ankur aggarwal To: "i...@mca_2007" ; lets-talk-g...@googlegroups.com; algogeeks@googlegroups.com Sent: Sunday, 6 September, 2009 2:58:40 PM Subject: [algogeeks] find tri

[algogeeks] Re: n balls having k colors

2009-09-08 Thread manish bhatia
Assign 0 to K numbers to all K colors, such that color -> color_tag (a number b/w [0,K-1]). code[k] = {0,2,..,k-1} foreach (permutation from all possible-permuations of code[])     sort balls[] on the basis of code[color_tag]     print balls[] From: ankur aggarw

[algogeeks] Re: Find longest palindrom in a give n string in O(N)

2009-09-06 Thread manish bhatia
Could you please elaborate? From: ankur aggarwal To: algogeeks@googlegroups.com Sent: Tuesday, 1 September, 2009 6:01:51 PM Subject: [algogeeks] Re: Find longest palindrom in a give n string in O(N) On Tue, Sep 1, 2009 at 2:24 PM, Nayn wrote: >"Working w

[algogeeks] Re: path from n1 to n2

2009-08-28 Thread manish bhatia
How should a toposort help? From: ankur aggarwal To: algogeeks@googlegroups.com Sent: Thursday, 27 August, 2009 9:15:47 AM Subject: [algogeeks] Re: path from n1 to n2 @ >_dufus > > >i also think dfs can solve this problem widout topological sort > >

[algogeeks] Re: path from n1 to n2

2009-08-28 Thread manish bhatia
A simple DFS should give you this (populating the path as we do the traversal). Now only question is when we get a forward-edge, i.e. a convergence-point, we have two options, (Assuming that while coming back after hitting n2, we keep marking vertices which have n2 in the fanout, similarly mark

[algogeeks] Re: Merging companies

2009-08-25 Thread manish bhatia
Suppose nCp represents n!(n-p)!/p! The product of the following should be the answer, nC2 x (n-1)C2 x (n-2) x ... x 2C2 The above assumes that merger of company K1 with K2, gives rise to a new company K12, and merger of K12 with K3, and K13 with K2 is different. How does it sound?  

[algogeeks] Re: Question asked in MS interview

2009-08-17 Thread manish bhatia
list lastNWords contains last N words, first being the one encountered most recently // suppose following function gets called whenever a new word is encountered void addNewWord(string newWord, map::iterator>& mp, list& lastNWords) {     lastNWords.push_front(newWord); if(mp.find(newWord) !

[algogeeks] Re: Check divisibility by 3

2009-08-17 Thread manish bhatia
Keep adding the digits till you are reduced to single digit. Then check if it is 3, 6 or 9 From: richa gupta To: programming-puzzles ; algogeeks Sent: Friday, 14 August, 2009 1:15:13 PM Subject: [algogeeks] Check divisibility by 3 can we check the divisibi

[algogeeks] Re: Finding repeated element in most efficient way

2009-08-11 Thread manish bhatia
Well instead of using extra memory, we can in-place sort the arraay  in O(nlog(n)) and then do an iteration (O(n)) to find out the repeated number. But the catch is that number is repeated 2^i times. That is the hint we should use From: ankur aggarwal To: alg

[algogeeks] Re: Spell Checker

2009-07-31 Thread manish bhatia
He meant alternate-spellings! Just like you get from MS-Word et. al. From: Vikram Sridar To: algogeeks@googlegroups.com Sent: Friday, 31 July, 2009 7:03:54 PM Subject: [algogeeks] Re: Spell Checker Alternatives?? what way?? In terms of implementation or provi

[algogeeks] Allocation problem

2009-06-18 Thread Manish Garg
and insert into queue. 3. Repeat steps one and two till queue is empty. Please suggest the solution that can fit in loop of any level down. -- With Best Regards... --- Manish --~--~-~--~~~---~--~~ You received this message because you are subscribed to th

[algogeeks] Re: Array of integers

2007-11-19 Thread Manish Garg
). > > > On Nov 17, 3:42 pm, geekko <[EMAIL PROTECTED]> wrote: > > Suppose that you have an array of integers. Given a number X are there > > any two numbers in the array in which their summation is equal to the > > X? Can you find a solution in O(n)? &

[algogeeks] Re: selecting data region, 2d, multi-d

2007-08-11 Thread Manish Garg
> > > Selecting a rectangle is O(log N * M) where M is the number of > datapoints in the 'band'. > Anyone know of anything better? > i think u can come up with an proof that we can make any algorithm that has complexity less then O(log N * M)...if u have all point array sorted... one more thing..

[algogeeks] Re: Longest Common Sequence

2007-08-11 Thread Manish Garg
me some pointers please? TIA. > > > > What regular expression might that be? What's the connection between > > the title of your post and the problem you are trying to solve? > > Can you be a little more precise? > > > > > -- With Best Regards... -

  1   2   >