Re: [algogeeks] Ittiam systems

2011-08-24 Thread ravi kumar
First step would be a written test.In the test you will have to answer two papers, one is a simple aptitude paper(no english) and the other one is one of your like from CS,EE and DSP. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

Re: [algogeeks]

2011-08-24 Thread binayakranjan das
hey guys i donno whther it will work or not..bt hw about taking the address of header and store in a variable .traverse through the linklist and check whether the pointer is pointing to a address which is less than the variable.when u r finding such a situation it will detect a loop.

Re: [algogeeks]

2011-08-24 Thread shashi kant
*http://ostermiller.org/find_loop_singly_linked_list.html *refer for the solution to loop detection* * On Wed, Aug 24, 2011 at 1:04 PM, binayakranjan das binayakran...@gmail.comwrote: hey guys i donno whther it will work or not..bt hw about taking the address of header and store in

Re: [algogeeks] Linklist question

2011-08-24 Thread shashi kant
well there is no other way.but to keep some storage On Wed, Aug 24, 2011 at 9:44 AM, Ankur Goel goel.anku...@gmail.com wrote: Hmmm this is one way any other ? On Wed, Aug 24, 2011 at 9:42 AM, Dheeraj Sharma dheerajsharma1...@gmail.com wrote: u can keep a count..which is incremented

[algogeeks] Re: My MORGAN STANLEY INTERVIEW Process

2011-08-24 Thread Ankit Minglani :)
I just joined back .. On Aug 24, 8:59 am, shady sinv...@gmail.com wrote: lol, he is still part of the group On Wed, Aug 24, 2011 at 9:25 AM, saurabh singh saurab...@gmail.com wrote: Its not spamIts just that adfly is a bad shortening url.Wait for few seconds then skip the ad.

Re: [algogeeks] Ittiam systems

2011-08-24 Thread dexter does
I am from CS.what about the interview...and does the writen test will be on progrmming or general concepts of CS -- 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] Re: question on fork()

2011-08-24 Thread shashi kant
6 red 10 greens On Wed, Aug 24, 2011 at 9:25 AM, Ankuj Gupta ankuj2...@gmail.com wrote: how can be there 20 greens ? On Aug 24, 12:12 am, DK divyekap...@gmail.com wrote: The standard library is neither multithread safe nor multiprocess safe. If you want the correct answer, use shared

Re: [algogeeks] Re: Concept of Pointer

2011-08-24 Thread Avinash LetsUncomplicate..
++ is simply post increment will increment after use so *s is printed in first printf.. precedence doesnt matter coz its a single operand on which post increment has to be done also no copncept of associativity i think associativity is for same precedence operators .. Avinash NIT allahabad

Re: [algogeeks] Re: Process memory Layout

2011-08-24 Thread DeVaNsH gUpTa
What i am saying is if i write it like p[5]= 'a'; Then the compiler will raise an error . Because the memory where the string constant Hello world gets stored is read only. But it i do it like char s[] = hello world,*p; p=s; p[5]='a'; It is valid becoz the string is now stored in

[algogeeks] Find the non-duplicate element in sorted array in O(n) time

2011-08-24 Thread atul purohit
Hi, A* sorted *integer array contains elements in pairs. All the pairs are complete except one element whose pair is missing. Find that element. Ex. { 1,1,2,2,2,2,3,3,4,5,5} result = 5 There is a standard solution which returns an XOR of all the elements. But this needs O(n) time complexity.

[algogeeks] Re: Find the non-duplicate element in sorted array in O(n) time

2011-08-24 Thread Venkat
we can solve this with the help of binary search. we know N, which is odd(because of one pair missing) We divide it array. Let consider your input { 1,1,2,2,2,2,3,3,4,5,5} int find_culprit(int[] array, int start, int end) { if(end==start) return -1; int mid=((end-start) / 2) + start; if

Re: [algogeeks] Re: Find the non-duplicate element in sorted array in O(n) time

2011-08-24 Thread Ankit Minglani
How about this : We use a divide and conquer approach and since the array is sorted. We find the middle element and check its value with its immediate left and right element .. it must match with anyone of them .. if it doesnt we have found such a element . and otherwise we divide the array again

Re: [algogeeks] Re: Find the non-duplicate element in sorted array in O(n) time

2011-08-24 Thread Sanjay Rajpal
@Venkat : suppose if the array were : 1 2 2 2 2 2 2 2 2 2 2, would ur solution work ? Sanju :) On Wed, Aug 24, 2011 at 3:58 AM, Ankit Minglani ankit.mingl...@gmail.comwrote: How about this : We use a divide and conquer approach and since the array is sorted. We find the middle element and

[algogeeks] inmobi

2011-08-24 Thread ravinder s
does anybody have any idea on recruitment process of inmobi ? -- 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

Re: [algogeeks] spoj coin tossing

2011-08-24 Thread shashi kant
http://www.se.cuhk.edu.hk/~seem3570/12-pattern.pdf here is the solution to this On Wed, Aug 24, 2011 at 7:25 AM, keyankarthi keyankarthi1...@gmail.comwrote: http://www.spoj.pl/problems/MAIN8_D/ i tried solving this problem any ideas...?? for second test case 'htht' the states i

[algogeeks] Re: Find the non-duplicate element in sorted array in O(n) time

2011-08-24 Thread Venkat
@Sanju: For your input both above solution wont work... Do you ve any soultion for your input?? For your input Xor all numbers - will give you the result:) but its O(n) Anyway your input allow everyone to think little wider than Binay search. Thanks Venkat On Aug 24, 4:05 pm, Sanjay

[algogeeks] Re: question on fork()

2011-08-24 Thread DK
@Ankuj: Sorry. I read the getch() as a call to green(). Please ignore the 20 green(). It should be 10 green() instead. -- DK http://twitter.com/divyekapoor http://www.divye.in http://gplus.to/divyekapoor -- You received this message because you are subscribed to the Google Groups Algorithm

[algogeeks] Fwd: inmobi

2011-08-24 Thread ravinder s
guys pl share the experience of inmobi -- Forwarded message -- From: ravinder s ravinderr...@gmail.com Date: Wed, Aug 24, 2011 at 5:24 PM Subject: inmobi To: algogeeks@googlegroups.com does anybody have any idea on recruitment process of inmobi ? -- You received this message

Re: [algogeeks] Re: Find the non-duplicate element in sorted array in O(n) time

2011-08-24 Thread Sanjay Rajpal
yes this is the only one till now, but i think we can do better also. Hope a better solution will be posted by someone soon. Sanju :) On Wed, Aug 24, 2011 at 5:22 AM, Venkat venkataharishan...@gmail.comwrote: @Sanju: For your input both above solution wont work... Do you ve any soultion

[algogeeks] C code scanf problem

2011-08-24 Thread Mehnaaz
#include stdio.h #define max 30 int no_p; int main() { char p[no_p][max]; char x; int i=0; printf(enter the no of productions..\n); scanf(%d, no_p); printf(you have entered :%d\n, no_p); printf(Variable who's FOLLOW

Re: [algogeeks] C code scanf problem

2011-08-24 Thread Sanjay Rajpal
after first scanf, place a call to fflush(stdin). you will get the result. Sanju :) On Wed, Aug 24, 2011 at 5:58 AM, Mehnaaz mehnaazmohiud...@gmail.com wrote: #include stdio.h #define max 30 int no_p; int main() { char p[no_p][max]; char x; int i=0;

Re: [algogeeks] Re: C Trick

2011-08-24 Thread priyanka raju
int a,b,max,min; max=(a+b+abs(a-b))/2; min=(a+b-abs(a-b))/2; -- cheers priyanka -- 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

Re: [algogeeks] Re: C Trick

2011-08-24 Thread Sanjay Rajpal
nice solution priyanka :) Sanju :) On Wed, Aug 24, 2011 at 6:03 AM, priyanka raju priyark...@gmail.com wrote: int a,b,max,min; max=(a+b+abs(a-b))/2; min=(a+b-abs(a-b))/2; -- cheers priyanka -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] spoj coin tossing

2011-08-24 Thread keyan karthi
thanks *Shashi* !!! http://deepblue.lib.umich.edu/bitstream/2027.42/24435/1/708.pdf this one is good to :) On Wed, Aug 24, 2011 at 5:32 PM, shashi kant shashiski...@gmail.com wrote: http://www.se.cuhk.edu.hk/~seem3570/12-pattern.pdf here is the solution to this On Wed, Aug 24,

Re: [algogeeks] spoj coin tossing

2011-08-24 Thread keyan karthi
^typo On Wed, Aug 24, 2011 at 6:46 PM, keyan karthi keyankarthi1...@gmail.comwrote: thanks *Shashi* !!! http://deepblue.lib.umich.edu/bitstream/2027.42/24435/1/708.pdf this one is good to :) On Wed, Aug 24, 2011 at 5:32 PM, shashi kant shashiski...@gmail.comwrote:

Re: [algogeeks] C code scanf problem

2011-08-24 Thread lakshay girdhar
it takes \n as character on input buffer for each enter keystroke so use fflush(stdin); before 2nd scanf. On Wed, Aug 24, 2011 at 6:30 PM, Sanjay Rajpal srn...@gmail.com wrote: after first scanf, place a call to fflush(stdin). you will get the result. Sanju :) On Wed, Aug 24, 2011 at

[algogeeks] Re: MS Question

2011-08-24 Thread vikas
what do you mean by a function for finding the next word is given ? On Aug 22, 1:56 am, Ankur Garg ankurga...@gmail.com wrote: Question--      Given a document containing some words ...and a function for finding the next word is given .design a code which efficiently   search the word  

Re: [algogeeks] c

2011-08-24 Thread saurabh agrawal
Does anyone has idea about what pacific asked for.? On Sun, Aug 21, 2011 at 11:01 AM, pacific :-) pacific4...@gmail.com wrote: Is const a compiler level construct ? #include stdio.h int main() { const int i = 0; int * p ; p = (int *) i; *p = 2; printf((i,p): %x %x \n,i,p);

Re: [algogeeks] Re: Concept of Pointer

2011-08-24 Thread Dheeraj Sharma
* and + have same precedence so right to left associatvty for first printf..and the rest printf statements are similar On Wed, Aug 24, 2011 at 2:54 PM, Avinash LetsUncomplicate.. avin.2...@gmail.com wrote: ++ is simply post increment will increment after use so *s is printed in first printf..

[algogeeks] question in C

2011-08-24 Thread sadhana kumar
Can anyone explain this code pls?? #include stdio.h #define f(a,b) a##b #define g(a) #a #define h(a) g(a) int main() { printf(%s\n,h(f(1,2))); printf(%s\n,g(f(1,2))); return 0; } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] Re: C code scanf problem

2011-08-24 Thread lakshay girdhar
i hav executed it in dev.. it waits for second scanf On Wed, Aug 24, 2011 at 7:05 PM, Mehnaaz mehnaazmohiud...@gmail.com wrote: @lakshay and sanju.after placing fflush(stdin), i am continuing to get the same output...is there anything else i can do..? and will you also please execute and see

Re: [algogeeks] C code scanf problem

2011-08-24 Thread vikas singh
On Wed, Aug 24, 2011 at 6:28 PM, Mehnaaz mehnaazmohiud...@gmail.com wrote: #include stdio.h #define max 30 int no_p; int main() { char p[no_p][max]; char x; int i=0; printf(enter the no of productions..\n); scanf(%d, no_p);

Re: [algogeeks] C Trick

2011-08-24 Thread vikas singh
On Tue, Aug 23, 2011 at 7:50 PM, *$* gopi.komand...@gmail.com wrote: int a,b; int c=a-b; c=c31; c=c31; // hope you're trying for this. ;) int x =c0x01; a=a-x*c; Thx, --Gopi On Tue, Aug 23, 2011 at 7:32 PM, Sanjay Rajpal srn...@gmail.com wrote: @teja : use of comparison operator

[algogeeks] Need info Regarding CA Technologies

2011-08-24 Thread vikas singh
I need to know, What's the Recruitment Procedure in college of CA Technologies.. Any Link, any info.. Plz Provide it ASAP.. 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] Re: C code scanf problem

2011-08-24 Thread Mehnaaz
@ vikas ..the space actually worked !!..is there any explanation ??..thanks a ton! -- 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] sadhana kumar wants to chat

2011-08-24 Thread sadhana kumar
--- sadhana kumar 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-f4beb69113-4b9d35a73c-9e0r9susOh2q6J3cuY5fpWqlsCc You'll

[algogeeks] Re: C code scanf problem

2011-08-24 Thread Don
The problem is that scanf(%c will take whatever character is next, even if it is not the one you think you typed. When you typed your first entry, the number 3 and then pressed Return, the \n character is left in the buffer, so your scanf gets that character instead of the one you want. The space

[algogeeks] Re: C doubt

2011-08-24 Thread Don
If you are working in C++, stl has a vector container class which will do this. Otherwise, declare an integer pointer in the struct and use malloc to allocate memory for it. Then you can use it like an array. Don On Aug 23, 11:51 pm, Arun Vishwanathan aaron.nar...@gmail.com wrote: say that you

Re: [algogeeks] reverse

2011-08-24 Thread aditya kumar
does anyone know the correct solution this problem ?? problem : i/p :: 39 o/p:: 93 (using bitwise operator) On Fri, Aug 12, 2011 at 1:41 PM, Prakash D cegprak...@gmail.com wrote: how does the above code work? On Fri, Aug 12, 2011 at 1:14 PM, Rahul raikra...@gmail.com wrote: I understand.

Re: [algogeeks] C Trick

2011-08-24 Thread praneethn
*max=(ab)*a+(ba)*b;* On Wed, Aug 24, 2011 at 7:32 PM, vikas singh shyguy1...@gmail.com wrote: On Tue, Aug 23, 2011 at 7:50 PM, *$* gopi.komand...@gmail.com wrote: int a,b; int c=a-b; c=c31; c=c31; // hope you're trying for this. ;) int x =c0x01; a=a-x*c; Thx, --Gopi On Tue,

Re: [algogeeks] C Trick

2011-08-24 Thread vikas singh
On Wed, Aug 24, 2011 at 8:25 PM, praneethn praneeth...@gmail.com wrote: *max=(ab)*a+(ba)*b;* Not allowed ;) Read the constraints applied. -- Thanks and Regards VIKAS SINGH MCA- final year NIT DURGAPUR email: vikas.singh1...@gmail.com shyguy1...@gmail.com http://smrit.wordpress.com -- You

[algogeeks] Remove all Duplicates Words

2011-08-24 Thread UMESH KUMAR
Qn. Remove all duplicates words from given a line without using extra memory ? Ex:-Hello word hello hi Out put:- Hello word hi -- 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

[algogeeks] LCA for a binary trees (not BST)

2011-08-24 Thread bugaboo
Hey group, Just wondering what the hullabaloo is since I see various dynamic programming solutions. What do you think is wrong or non-elegant about the following (quite intuitive) logic: 1) Do a DFS for node1 [O(n)] and store path in string str1 2) Do a DFS for node2 [O(n)] and store path in

[algogeeks] Re: LCA for a binary trees (not BST)

2011-08-24 Thread bugaboo
Just to add more details: Overall time complexity will be O(nlogn) If hash maps are used for step (3), then searching becomes O(1). The time xomplexity then reduces to O(n). On Aug 24, 10:15 am, bugaboo bharath.sri...@gmail.com wrote: Hey group, Just wondering what the hullabaloo is since I

[algogeeks] Re: C code scanf problem

2011-08-24 Thread Anurag Gupta
@ Mehnaaz :the variable no_p will be equal to 0,since it is an external one so the declaration char p[no_p][max] is equivalent to p[0][max]; and size of p is zero. then how you can insert anything into it as you are doing in for loop? no_p may receive some non zero value afterwards but array p is

Re: [algogeeks] Re: Adobe Interview - 20/08/2011

2011-08-24 Thread rakesh kumar
Hi All, for checkouts problem how about finding the median for all the times 8-00 8-15 830 sort the second list 8-30 900 920 if we take the mediun of whole list then it will be 8-30 where max no of people will be present Will it work.. Any body has any idea?? On Wed, Aug 24, 2011 at

Re: [algogeeks] Re: Adobe Interview - 20/08/2011

2011-08-24 Thread rakesh kumar
Hi Anybody has answer for sphere problem...could you please proivde On Wed, Aug 24, 2011 at 9:10 PM, rakesh kumar rockey.rav...@gmail.comwrote: Hi All, for checkouts problem how about finding the median for all the times 8-00 8-15 830 sort the second list 8-30 900 920 if we take the

[algogeeks] map problem

2011-08-24 Thread mohit verma
hey guys , i want to store 3 values in stl map making float as key value. I am doing something like this - typedef const int twoint[2]; mapfloat,twoint mmap; but when i try to insert using make_pair() , compiler shows some error. could someone tell me how to include these 2 more values

Re: [algogeeks] reverse

2011-08-24 Thread aditi garg
though im very unsure abt this,but how abt converting the number to BCD and then normal swapping of the two nibbles?? Bt i guess this would work only for 2 digit numbers... On Wed, Aug 24, 2011 at 8:20 PM, aditya kumar aditya.kumar130...@gmail.comwrote: does anyone know the correct solution

[algogeeks] Fwd: vertical sum

2011-08-24 Thread Nikhil Veliath
-- Forwarded message -- From: Nikhil Veliath nve...@gmail.com Date: 24 Aug 2011 21:18 Subject: vertical sum To: algogeeks@googlegroups.com algogeeks@googlegroups.com find the vertical sum of a binary tree . . . wat do we mean by vertical sum anyone any help -- You received

[algogeeks] Fwd: vertical sum

2011-08-24 Thread Nikhil Veliath
find vertical sum of a binary tree . . . wat do we mean by vertical sum -- Forwarded message -- From: Nikhil Veliath nve...@gmail.com Date: 24 Aug 2011 21:18 Subject: vertical sum To: algogeeks@googlegroups.com algogeeks@googlegroups.com find the vertical sum of a binary tree . .

Re: [algogeeks] Re: C doubt

2011-08-24 Thread sagar pareek
See if we use dynamic memory allocation then still the size of pointer will be 4 bytes only Mean that int* pointer still have the size equals to pointer ... malloc only returns new alloted memory which is now only *pointed *by that pointer check this out :- http://www.ideone.com/20ayq On

Re: [algogeeks] Remove all Duplicates Words

2011-08-24 Thread sagar pareek
use hashing On Wed, Aug 24, 2011 at 8:43 PM, UMESH KUMAR kumar.umesh...@gmail.comwrote: Qn. Remove all duplicates words from given a line without using extra memory ? Ex:-Hello word hello hi Out put:- Hello word hi -- You received this message because you are subscribed to the Google

[algogeeks] Re: probability ques

2011-08-24 Thread Don
First find the endpoints of the region where the condition is met: a + 100/a = 50 a^2 - 50a + 100 = 0 By the quadratic formula, a is 2.08712 or 47.9128. The range is 45.8256. A falls in the range of 1..100 or 99. So the probability is 47.9128/99 = 0.48397 Don On Aug 23, 11:56 am, ramya reddy

Re: [algogeeks] Re: Multiprocessor scheduling

2011-08-24 Thread Nikhil Gupta
@Saurabh: what does your algo does when the number of jobs are much more than the number of processors?? On Wed, Aug 24, 2011 at 7:55 AM, saurabh singh saurab...@gmail.com wrote: sorry a typoRound the sum to the next multiple of number of processors.Alternatively taking the ceil of per

[algogeeks] Re: reverse

2011-08-24 Thread Dave
@Anika: So you want to reverse the digits of the decimal representation of a number. Extracting decimal digits requires division and modulus by 10. Normally this is done by division, but as a different recent thread has shown, division can be accomplished by bit operations, comparisons, and

Re: [algogeeks] C Trick

2011-08-24 Thread Anup Ghatage
Priyanka raju's solution will not work if a = 3 and b = -2 On Wed, Aug 24, 2011 at 8:28 PM, vikas singh shyguy1...@gmail.com wrote: On Wed, Aug 24, 2011 at 8:25 PM, praneethn praneeth...@gmail.com wrote: *max=(ab)*a+(ba)*b;* Not allowed ;) Read the constraints applied. -- Thanks and

[algogeeks] Re: C code scanf problem

2011-08-24 Thread Mehnaaz
that was actually a mistake , i should have taken the value before i declared it BUT as for arrays goes, we know we can access the a[10] even though we may just declare a[5] ! may be its the same reason i was able to read in for loop besides here having the size of column matters more than the

Re: [algogeeks] C Trick

2011-08-24 Thread *$*
oops! yes I was trying to find whether that number is negative or positive by shifting the highest bit to oth location... that is a typo error.. Thanks for pointing out! On Wed, Aug 24, 2011 at 7:32 PM, vikas singh shyguy1...@gmail.com wrote: On Tue, Aug 23, 2011 at 7:50 PM, *$*

[algogeeks] Re: C doubt

2011-08-24 Thread Don
Yes, the memory provided by malloc will not be in the structure. Only the pointer to that memory will be in the structure. The size of a struct is defined at compile time, so it can't be dynamically sized at run time. struct junk { int size; int *data; }; Somewhere in the code: struct junk

Re: [algogeeks] Re: Find the non-duplicate element in sorted array in O(n) time

2011-08-24 Thread Ankur Garg
Hi The ques explicitly said the elements are in pairs ...But the one given by sanjay has more than 2 2's ...that question cant be done using bsearch then On Wed, Aug 24, 2011 at 6:21 PM, Sanjay Rajpal srn...@gmail.com wrote: yes this is the only one till now, but i think we can do better also.

[algogeeks] inmobi

2011-08-24 Thread ravinder s
guys plz reply !!! -- 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

Re: [algogeeks] C Trick

2011-08-24 Thread Abhishek Yadav
@Anup: i think priyanka's solution would work for 3 and -2 On Wed, Aug 24, 2011 at 10:05 PM, *$* gopi.komand...@gmail.com wrote: oops! yes I was trying to find whether that number is negative or positive by shifting the highest bit to oth location... that is a typo error.. Thanks for

Re: [algogeeks] C Trick

2011-08-24 Thread Anup Ghatage
Please explain with the example, I just joined, so I may have missed the earlier details :) On Wed, Aug 24, 2011 at 10:11 PM, Abhishek Yadav algowithabhis...@gmail.com wrote: @Anup: i think priyanka's solution would work for 3 and -2 On Wed, Aug 24, 2011 at 10:05 PM, *$*

[algogeeks] Re: map problem

2011-08-24 Thread Anusha
u can declare and insert in this way typedef mapfloat,int mmap; for inserting within a for loop insert using cin for(i=0;in;i++) { cinmmap[i]; } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

Re: [algogeeks] Re: map problem

2011-08-24 Thread Nikhil Kumar
Post your pair functions ..I'm sure you're wrong there! -- 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] Re: map problem

2011-08-24 Thread anusha
u can declare it without an initial size typedef mapfloat,int mmap; u can then insert values using cin within a for loop for(i=0;i5;i++) { cinmmap[i]; } c if this works regards anusha On Aug 24, 8:46 pm, mohit verma mohit89m...@gmail.com wrote: hey guys , i want to store 3 values in

Re: [algogeeks] reverse

2011-08-24 Thread Sanjay Rajpal
assuming unsigned integers and 8-bit size,and n to be the number, logic is : n 4 | n 4. Correct me if m wrong. Sanju :) On Wed, Aug 24, 2011 at 8:51 AM, aditi garg aditi.garg.6...@gmail.comwrote: though im very unsure abt this,but how abt converting the number to BCD and then normal

Re: [algogeeks] Re: Find the non-duplicate element in sorted array in O(n) time

2011-08-24 Thread sagar pareek
See interviewer said that it can be done in O(n) and also only *ONE* pair is missing i have two approaches 1st approach check 1st element say n= arr[0] // i=0 now in the for() loop increment i by 2 // i=2 check if arr[i-1]==n? if no, answer is n else n=arr[i] and repeat the same with i+=2;

Re: [algogeeks] Re: Multiprocessor scheduling

2011-08-24 Thread saurabh singh
works fine for the case taken in the codeCheck if it fails for any case please. http://www.ideone.com/paKYX On Wed, Aug 24, 2011 at 9:41 PM, Nikhil Gupta nikgp...@iitr.ernet.inwrote: @Saurabh: what does your algo does when the number of jobs are much more than the number of processors??

[algogeeks] Participate in Stanford Research for a chance to win an iPad

2011-08-24 Thread Sherin Thomas
---Original Message- Please forward our message to your friends and mailing lists. It will make a difference! Our research team at Stanford University is inviting participants to a simple online study. As a token of appreciation we will hold an Apple iPad 2 raffle at the end of the

Re: [algogeeks] Re: map problem

2011-08-24 Thread mohit verma
i think u guys dint get my question . what i want to do is : (1 float and 2 intergers) in a single map entry with float key value. i did it this way: typedef const int twoint[2]; mapfloat,twoint mmap; for inserting values i dint make any make_pair() function but used the default one like this-

Re: [algogeeks] Re: LCA for a binary trees (not BST)

2011-08-24 Thread Neha Singh
@bugaboo : you r storing the path in a string. Thats O(n) space which may not be an acceptable solution in many cases. If there is no space constraint, then ur solution is fine... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

[algogeeks] Fwd: Stanford Online Study - Win an iPad2

2011-08-24 Thread Vrashabh Irde
FYI -- Forwarded message -- From: Nicolas Kokkalis nico...@labs.stanford.edu Date: Wed, Aug 24, 2011 at 11:00 PM Subject: Stanford Online Study - Win an iPad2 To: vrashab...@gmail.com Hi Vrashabh, Please forward our message to your friends and mailing lists. It will make a

[algogeeks] Re: print all paths which sum up to a value.

2011-08-24 Thread Dumanshu
Any help regarding the preprocessing required for O(1) operation for LCA??? I read the wiki's article involving eulers traversal.. but its nt clear. On Aug 24, 1:12 am, DK divyekap...@gmail.com wrote: Hmm.. Interesting question. *Here's a solution:* There are n elements in the tree and

Re: [algogeeks] C Trick

2011-08-24 Thread priyanka raju
It will work... a=3 b=-2 max=(a+b+abs(a-b))/2 so max=(3-2+abs(3-(-2)))/2 =(1+abs(5))/2 =(1+5)/2 =3 Same in case of min -- cheers priyanka -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

[algogeeks] Re: Apti

2011-08-24 Thread icy`
nice prakash. Algorithm is definitely better than brute force. But here is brute force anyway, just go from 2 to square root of n ;P I initially misread it and thought you were asking for ANY {c,d} set in which c,d are factors of n (but not necessarily c*d = n) . That wouldve been all of

[algogeeks] large nos

2011-08-24 Thread MAC
any thoughts ? if we have link lists to represent very large integer numbers how to implement multiply and devide operator -- thanks --mac -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] Citrix C Question

2011-08-24 Thread Ankur Garg
Hi Suppose there is a program int main(){ printf(%t,main()); sleep(1000); return 0; } The above program is run from 100 different windows What will be the output Will there be any pattern Regards Ankur -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: MS Question

2011-08-24 Thread Ankur Garg
It means when u call that func u get the next word in the document Regards Ankur On Wed, Aug 24, 2011 at 6:59 PM, vikas vikas.rastogi2...@gmail.com wrote: what do you mean by a function for finding the next word is given ? On Aug 22, 1:56 am, Ankur Garg ankurga...@gmail.com wrote:

Re: [algogeeks] C Trick

2011-08-24 Thread kranthi kumar
@priyanka raju, Good solution... -- Regards: --- D Kranthi kumar Computer Science Engg. IIT Madras. -- 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

[algogeeks] Re: Anyone have The google resume book

2011-08-24 Thread RAJESH KANNAN S
Hi, http://dw3.convertfiles.com/files/0340683001314208083/0470927623.pdf the book is available in this link. On Jun 26, 10:20 pm, Swathi chukka.swa...@gmail.com wrote: -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] Remove all Duplicates Words

2011-08-24 Thread Ankur Garg
Both of these methods will require extra ,memory On Wed, Aug 24, 2011 at 9:42 PM, Anup Ghatage ghat...@gmail.com wrote: How about this, We compare the first character with every character except the characters in the word itself, if there is a hit, it might be a word which is a duplicate.

Re: [algogeeks] Re: C doubt

2011-08-24 Thread Arun Vishwanathan
thanks guys! On Wed, Aug 24, 2011 at 6:37 PM, Don dondod...@gmail.com wrote: Yes, the memory provided by malloc will not be in the structure. Only the pointer to that memory will be in the structure. The size of a struct is defined at compile time, so it can't be dynamically sized at run

[algogeeks] C-hexadecimal doubt

2011-08-24 Thread Arun Vishwanathan
Hi all, I need to store a hexadecimal value in C( which would be used as a request type in a network) of around 4digits( or 16 bits-2 bytes ) in a packet structure.If my system keeps 4 bytes for an integers, is it necessary that I have to declare the hex value as of type short int or so, so that

[algogeeks] Re: spoj coin tossing

2011-08-24 Thread him
1st one H-2^1+1 HTHT-2^4+4 TTHTHTHTHTHHTHTHTHTTHTHTT(33) - 2^33+6(why)? do you see any connection? On Aug 24, 6:55 am, keyankarthi keyankarthi1...@gmail.com wrote: http://www.spoj.pl/problems/MAIN8_D/ i tried solving this problem any ideas...?? for second test case 'htht' the

[algogeeks] Re: Anyone have The google resume book

2011-08-24 Thread Abhishek
+1 to Rajesh -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/jXs6BWypt_IJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe

[algogeeks] Elitmus test Help

2011-08-24 Thread rohit
Is anybody have any idea about pattern of elitmus test , Is It a C programming test or General aptitude test? -- 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

Re: [algogeeks] Elitmus test Help

2011-08-24 Thread Akanksha .
It is a general aptitude test.. they ask u ques on quant, verbel n problems solving skills.. prepare well if u r planning to take this test as ques r tough.. On Wed, Aug 24, 2011 at 11:45 PM, rohit rajuljain...@gmail.com wrote: Is anybody have any idea about pattern of elitmus test , Is It a C

[algogeeks] Re: C-hexadecimal doubt

2011-08-24 Thread Don
It is most common to use 4 bytes to store an integer value, even if the full range will not be used. There is no problem putting a 16-bit value into a 32-bit field. The only case where this is not true is when memory is extremely limited and you need to pack as much into every word as possible. Do

[algogeeks] Re: large nos

2011-08-24 Thread Dave
@Mac: Think of how you do multidigit multiplication and long division on paper. Dave On Aug 24, 12:43 pm, MAC macatad...@gmail.com wrote: any thoughts ? if we have link lists to represent very large integer numbers how to implement multiply and devide operator -- thanks --mac -- You

[algogeeks] Re: large nos

2011-08-24 Thread Don
Use NTL. Don On Aug 24, 12:43 pm, MAC macatad...@gmail.com wrote: any thoughts ? if we have link lists to represent very large integer numbers how to implement multiply and devide operator -- thanks --mac -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: large nos

2011-08-24 Thread Debabrata Das
well if you store value in link list as a polynomial the you can do multiplication as cross product. eg. 345=3*100 + 4*10 + 5*1 On Wed, Aug 24, 2011 at 11:53 PM, Don dondod...@gmail.com wrote: Use NTL. Don On Aug 24, 12:43 pm, MAC macatad...@gmail.com wrote: any thoughts ? if we have link

Re: [algogeeks] Re: C-hexadecimal doubt

2011-08-24 Thread Arun Vishwanathan
@don: so if a 16bit value is put into a 32 bit field and i need to read the value, do i need to read last 16 bits only somehow ? On Wed, Aug 24, 2011 at 8:22 PM, Don dondod...@gmail.com wrote: It is most common to use 4 bytes to store an integer value, even if the full range will not be used.

Re: [algogeeks] Elitmus test Help

2011-08-24 Thread Abhishek Sharma
similar to CAT though the level is little low... no technical questions are asked.. On Wed, Aug 24, 2011 at 11:50 PM, Akanksha . akanksha...@gmail.com wrote: It is a general aptitude test.. they ask u ques on quant, verbel n problems solving skills.. prepare well if u r planning to take this

Re: [algogeeks] Re: spoj coin tossing

2011-08-24 Thread Piyush Kapoor
@keyan karthi Can you explain a bit on how to use the markov chain to get the answer... On Wed, Aug 24, 2011 at 11:42 PM, him himanshuarora.1...@gmail.com wrote: 1st one H-2^1+1 HTHT-2^4+4 TTHTHTHTHTHHTHTHTHTTHTHTT(33) - 2^33+6(why)? do you see any connection? On Aug 24, 6:55 am,

Re: [algogeeks] Elitmus test Help

2011-08-24 Thread Khyati Gupta
Any body has sample paper of E-lithmus On Thu, Aug 25, 2011 at 12:17 AM, Abhishek Sharma jkabhishe...@gmail.comwrote: similar to CAT though the level is little low... no technical questions are asked.. On Wed, Aug 24, 2011 at 11:50 PM, Akanksha . akanksha...@gmail.comwrote: It is a

[algogeeks] Re: C code scanf problem

2011-08-24 Thread Ninad Page
On Aug 24, 6:00 pm, Sanjay Rajpal srn...@gmail.com wrote: after first scanf, place a call to fflush(stdin). you will get the result. Sanju :) Flushing the input stream is undefined. On Wed, Aug 24, 2011 at 5:58 AM, Mehnaaz mehnaazmohiud...@gmail.com wrote: #include stdio.h

[algogeeks] Doublly link list

2011-08-24 Thread Anshul Khandelwal
Write an algo to implement double link list using only one single pointer ?? -- ANSHUL KHANDELWAL B.TECH. 4th yr. Computer Engineering Malaviya National Institute Of Technology, Jaipur -- You received this message because you are subscribed to

[algogeeks] Re: Find the non-duplicate element in sorted array in O(n) time

2011-08-24 Thread Don
I'm going to assume that elements in pairs means exactly two of each element except for the one which is missing it's pair. The recursive solution is simple, but it only uses tail recursion, so it is worthwhile to do it iteratively. int findSingle(int *a, int size) { int result; while(1) {

  1   2   >