Re: [algogeeks] Re: spoj coin tossing

2011-08-24 Thread Aastha Rai
hey! the solution can be found by summation from 1 to n + 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

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

2011-08-24 Thread sagar pareek
mine approach is log(n) check it out first On Thu, Aug 25, 2011 at 1:21 AM, Don dondod...@gmail.com wrote: 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

Re: [algogeeks] Citrix C Question

2011-08-24 Thread prasanth n
@ankur: i think its error..l value required On Wed, Aug 24, 2011 at 11:18 PM, Ankur Garg ankurga...@gmail.com wrote: 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

[algogeeks] Re: Doublly link list

2011-08-24 Thread Abhishek
in brief, in the next pointer put the XOR value of previous and next block address. when you want to access the previous node just do the XOR operation with next block address and for next node do the XOR operation with previous block address. it will require an extra variable to maintain either

[algogeeks] Re: C-hexadecimal doubt

2011-08-24 Thread Ninad Page
On Aug 24, 11:41 pm, Arun Vishwanathan aaron.nar...@gmail.com wrote: @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 ? As long as you are saving those 16 bits in a variable (an integer, a bit-field or

Re: [algogeeks] Citrix C Question

2011-08-24 Thread Ankur Garg
I dont think it will be error, U r passing main function as reference so it will print some address .. The only concern is when u execute this 100 or more times will there be some pattern in the answer ? Regards Ankur On Thu, Aug 25, 2011 at 1:41 AM, prasanth n nprasnt...@gmail.com wrote:

[algogeeks] Re: C code scanf problem

2011-08-24 Thread KK
Using getchar() after the first scanf ll be much better...!! -- 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: Doublly link list

2011-08-24 Thread Mohit kumar lal
it might cause STACK OVERFLOW for larger size of lists. On Thu, Aug 25, 2011 at 2:04 AM, Abhishek mailatabhishekgu...@gmail.comwrote: in brief, in the next pointer put the XOR value of previous and next block address. when you want to access the previous node just do the XOR operation with

[algogeeks] Tree quuestion

2011-08-24 Thread rohit
How to find the distance of a node from the root of the tree?? Give algorithm. -- 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/-/hL50R3KOgGgJ. To post to this

Re: [algogeeks] Re: binary tree ques

2011-08-24 Thread Anantha Krishnan
Hi, We can do like this, int computeXY(Tnode *root,int x,int y) { if(root==NULL) return x; root-y=y; int l=computeXY(root-left,x,y-1); root-x=l+1; int r=computeXY(root-right,root-x,y-1); return r; } call it as, computeXY(root,-1,getHeight(root,0)-1); Thanks

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

2011-08-24 Thread Don
I assume that elements in pairs means that each value occurs exactly twice except for the one single. This algorithm is O(log n) and is nonrecursive. Writing it recursively would make it a couple of lines shorter, but because it is purely tail recursion, that is not necessary. // Given an array a

Re: [algogeeks] Re: Doublly link list

2011-08-24 Thread Ankur Garg
http://en.wikipedia.org/wiki/XOR_linked_list Check this...will be handy On Thu, Aug 25, 2011 at 2:12 AM, Mohit kumar lal kumarmohit...@gmail.comwrote: it might cause STACK OVERFLOW for larger size of lists. On Thu, Aug 25, 2011 at 2:04 AM, Abhishek mailatabhishekgu...@gmail.comwrote: in

Re: [algogeeks] Tree quuestion

2011-08-24 Thread Anantha Krishnan
int getDistance(Tnode *root,Tnode *node,int dist) { if(root==NULL) return 0; if(root==node) return dist; return getDistance(root-left,node,dist+1)|getDistance(root-right,node,dist+1); } Thanks Regards, Anantha Krishnan On Thu, Aug 25, 2011 at 2:30 AM, rohit

Re: [algogeeks] Fwd: vertical sum

2011-08-24 Thread kritivasas shukla
well it means when you move right you add +1 to column and when you move left you add -1, you can do this by using linked list. On Wed, Aug 24, 2011 at 9:31 PM, Nikhil Veliath nve...@gmail.com wrote: find vertical sum of a binary tree . . . wat do we mean by vertical sum -- Forwarded

Re: [algogeeks] Remove all Duplicates Words

2011-08-24 Thread kritivasas shukla
how about using a trie tree?? -- 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] Remove all Duplicates Words

2011-08-24 Thread Gaurav Menghani
Do you mean even O(1) isn't good? On Wed, Aug 24, 2011 at 8:43 PM, UMESH KUMAR kumar.umesh...@gmail.com wrote: 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

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

2011-08-24 Thread smb
XOR all the elements, the answer is the number you want. On Aug 24, 5:11 pm, Don dondod...@gmail.com wrote: I assume that elements in pairs means that each value occurs exactly twice except for the one single. This algorithm is O(log n) and is nonrecursive. Writing it recursively would make

Re: [algogeeks] Re: large nos

2011-08-24 Thread MAC
@don : can you please share some link for NTL ??? @dave i am unable to understand what you mean ... this is because since these are very large numbers i can never save them as integers in ints or longs , so how ?? On Wed, Aug 24, 2011 at 11:57 PM, Debabrata Das debabrata.barunhal...@gmail.com

Re: [algogeeks] Remove all Duplicates Words

2011-08-24 Thread *$*
how about suffix tree? On Thu, Aug 25, 2011 at 4:22 AM, Gaurav Menghani gaurav.mengh...@gmail.comwrote: Do you mean even O(1) isn't good? On Wed, Aug 24, 2011 at 8:43 PM, UMESH KUMAR kumar.umesh...@gmail.com wrote: Qn. Remove all duplicates words from given a line without using extra

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

2011-08-24 Thread Dave
@Shailesh: Sir, your response is unresponsive, because the original poster specifically asked for a solution that was O(n). Please don't waste our time giving answers that so obviously do not meet the problem statement. Dave On Aug 24, 6:33 pm, smb shaileshbir...@gmail.com wrote: XOR all the

Re: [algogeeks] Re: C-hexadecimal doubt

2011-08-24 Thread saurabh singh
On Thu, Aug 25, 2011 at 2:04 AM, Ninad Page ninad1...@gmail.com wrote: If you stick to one convention its not that difficult to code without bothering about endian's.In your case if you want to have a variable data size for int(As far as I can guess),develop ur own integer interface using raw

[algogeeks] Re: large nos

2011-08-24 Thread Dave
@Mac: Regarding your question to Don: Did you try google before you asked? If not, why not? Regarding your question to me: The basic unit of numbers are digits. You may not have realized it, but when you were in elementary school you learned how to represent numbers as arrays of digits, and how

[algogeeks] Re: Remove all Duplicates Words

2011-08-24 Thread Dave
@Sagar: And how do you use hashing without extra memory? Please, please, please read the question, and don't bother to reply if you can't answer it? Dave On Aug 24, 11:10 am, sagar pareek sagarpar...@gmail.com wrote: use hashing On Wed, Aug 24, 2011 at 8:43 PM, UMESH KUMAR

Re: [algogeeks] Re: Remove all Duplicates Words

2011-08-24 Thread Ankur Khurana
Dave: are you not too much rude here ? yes it is one's responsibility to read the question but it is equally important to be humble . Same things can be answered and asked in different tones. Just try to maintain yours. Yours truly, A fellow brainstorm-er . On Thu, Aug 25, 2011 at 8:21 AM, Dave

Re: [algogeeks] Re: C dot

2011-08-24 Thread Dipankar Patro
C-Dot procedure (For Computers): - First shortlist on the basis of cgpa/ %age for interviews. - Only one round of interview, based on your resume. Discussion of projects and questions related to mainly OS, Networking and Programming. There is nothing as selection of Toppers only. If you are good

Re: Re: [algogeeks] Re: Remove all Duplicates Words

2011-08-24 Thread ghatage
@Ankur Garg: Please explain to me how my method uses extra memory? -- 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] elitmus test

2011-08-24 Thread ROHIT SINGHAL
well i got 85 % in that. Its lil tricky test u need to clear ur geometry skills for quant and prepare DI properly for logical portion. On Thu, Aug 25, 2011 at 9:49 AM, prasanna rockslife2...@gmail.com wrote: Hi Whosoever have taken the elitmus test, pls share the type of questions asked in

Re: [algogeeks] Elitmus test Help

2011-08-24 Thread ROHIT SINGHAL
i guss CAT se bhi zyada diff hai Elitmus. On Thu, Aug 25, 2011 at 12:56 AM, Khyati Gupta khyatigupt...@gmail.comwrote: 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

[algogeeks] Re: Elitmus test Help

2011-08-24 Thread prasanna
pls enlighten us with the questions asked in elitmus(if anyone could remember). On Aug 25, 9:30 am, ROHIT SINGHAL rohitksingha...@gmail.com wrote: i guss CAT se bhi zyada diff hai Elitmus. On Thu, Aug 25, 2011 at 12:56 AM, Khyati Gupta khyatigupt...@gmail.comwrote: Any body has

[algogeeks] Re: elitmus test

2011-08-24 Thread prasanna
thanks rohit. pls mentions some of the questions asked. On Aug 25, 9:29 am, ROHIT SINGHAL rohitksingha...@gmail.com wrote: well i got 85 % in that. Its lil tricky test u need to clear ur geometry skills for quant and prepare DI properly for logical portion. On Thu, Aug 25, 2011 at 9:49 AM,

[algogeeks] Loop in a linked list

2011-08-24 Thread rohit
Most commonly used algo to detect a loop in a linked list is to have two pointers running, one at double the speed of other and check if they meet..What is the time complexity of this algorithm? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Loop in a linked list

2011-08-24 Thread Neha Singh
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 options, visit this group at

[algogeeks] Re: Remove all Duplicates Words

2011-08-24 Thread Venkat
@Anup: your method wont use extra memory. your solution is correct. But i think we can find better soultion. Duplicate means Not only it occured 2 times, it may be 2,3 4..etc.. so we have to consider that also. In that case complexity will go like O(N^2) , N= number of words in line Thanks

<    1   2