Re: [algogeeks] Re: spoj problem

2011-11-18 Thread Amol Sharma
don't bother got AC was doing lot of extra overhead -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad http://gplus.to/amolsharma99 http://twitter.com/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://youtube.com/amolsharma99 On Fri, Nov

[algogeeks] Networking Question

2011-11-18 Thread Vijay Khandar
How many bytes of data can be sent in 15 seconds over a serial link with baud rate of 9600 inasynchronous mode with odd parity and two stop bits in the frame? a)10,000 bytes b)12,000 bytes c) 15,000 bytes d)27,000 bytes Plz anyone explain me. Vijay.. -- You received this message

[algogeeks] Re: COA Question

2011-11-18 Thread Vijay Khandar
Thanks!! On Nov 17, 11:32 pm, Dave dave_and_da...@juno.com wrote: d) Formal parameters, because they are in the definition of the macro. If they were in an invocation of a macro, they would be actual parameters, as in     ADD a,b a and b are actual parameters, and the macro expands

[algogeeks] Re: Computer Organisation Q

2011-11-18 Thread Vijay Khandar
but why? On Nov 18, 9:14 am, ((** VICKY **)) venkat.jun...@gmail.com wrote: False not necessarily. On Nov 17, 4:03 pm, Vijay Khandar vijaykhand...@gmail.com wrote: Can anyone explain following sentence- True or False and explain All instructions affect the flags Vijay

[algogeeks] Reading till EOF in python

2011-11-18 Thread shady
Can anyone tell how to read till the end of file in python language ? -- 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: Referral program @InMobi

2011-11-18 Thread siva viknesh
Post it in interviewstreet group On Nov 17, 10:35 pm, Raunak Agrawal raunak.ra...@gmail.com wrote: Hi All, Please find the job description attached and let me know if anyone is interested in any openings. And also please mention the post you wanna apply for. Some brief note about InMobi:

Re: [algogeeks] Reading till EOF in python

2011-11-18 Thread saurabh singh
Though its obvious but still to add an explanation to complete the response.On detecting EOF EOFError is exception is returned.I am catching that using pythons exception handling(just like try catch in c++).In except block u can include the operations that should be performed on catching EOF.Hope

[algogeeks] COA Question

2011-11-18 Thread Vijay Khandar
Relative mode of addressing is most relevant to writing a)coroutines b)position-independent code c)shareble code d)interrupt handlers plz anyone give me answer with explation... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Reading till EOF in python

2011-11-18 Thread saurabh singh
try: while 1: i=input() print i except EOFError: a='' One possible way..dont know if there are other elegant ways of doing the same. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Reading till EOF in python

2011-11-18 Thread Krishna Bharadwaj
Hi shady, this is how you do it.. while True: try: x = input() except EOFError: break On Fri, Nov 18, 2011 at 4:26 PM, shady sinv...@gmail.com wrote: Can anyone tell how to read till the end of file in python language ? -- You received this message because you are subscribed to

Re: [algogeeks] Reading till EOF in python

2011-11-18 Thread Amol Sharma
try except statement will do.. for example, try: a=int(input()) except EOFError: break ... your code here -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad http://gplus.to/amolsharma99

Re: [algogeeks] Reading till EOF in python

2011-11-18 Thread shady
thanks all. On Fri, Nov 18, 2011 at 4:30 PM, Krishna Bharadwaj krishna.bm...@gmail.comwrote: Hi shady, this is how you do it.. while True: try: x = input() except EOFError: break On Fri, Nov 18, 2011 at 4:26 PM, shady sinv...@gmail.com wrote: Can anyone tell how to read

[algogeeks] Problem

2011-11-18 Thread Zyro
Q: Select the K elements in an array of size N which are having the minimum difference among them? For Example : If you have an array like arr[]={9,5,2,6,3,11} and value of K is 3. Then ans would be {2,3,5}. -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] Re: deep vs shallow copy

2011-11-18 Thread Dheeraj Jain
http://geeksforgeeks.org/forum/topic/deep-copy-vs-shallow-copy On Fri, Nov 18, 2011 at 12:58 PM, Gene gene.ress...@gmail.com wrote: The most extreme shallow copy is just copying a pointer to a large data structure like a graph or tree. Deep copy is copying the entire data structure and

Re: [algogeeks] Re: deep vs shallow copy

2011-11-18 Thread atul anand
http://www.learncpp.com/cpp-tutorial/912-shallow-vs-deep-copying/ On Fri, Nov 18, 2011 at 8:30 PM, Dheeraj Jain dheerajj...@gmail.com wrote: http://geeksforgeeks.org/forum/topic/deep-copy-vs-shallow-copy On Fri, Nov 18, 2011 at 12:58 PM, Gene gene.ress...@gmail.com wrote: The most extreme

Re: [algogeeks] Problem

2011-11-18 Thread MeHdi KaZemI
If I'm right you want a subset which has k elements and the difference of the smallest and the largest element is minimum. You can do it in O( Nlog(N) ). *Sort input* in ascending order, then iterate through the array and keep the difference of the last k elements. O( nlogn + n ) belongs to

[algogeeks] Re: Problem

2011-11-18 Thread shady
what do you mean by difference among them ? do we need to select the elements to minimize the sum between consecutive elements ? or only the first and last element ? On Nov 18, 6:30 pm, Zyro vivkum...@gmail.com wrote: Q: Select the K elements in an array of size N which are having the minimum

[algogeeks] Re: Problem

2011-11-18 Thread Zyro
sorry...minimize sum of the difference between the elements of the subset.. On Nov 19, 10:03 am, shady sinv...@gmail.com wrote: what do you mean by difference among them ? do we need to select the elements to minimize the sum between consecutive elements ? or only the first and last element ?

[algogeeks] Re: Problem

2011-11-18 Thread Zyro
The Sum of the difference in the Subset containing the K elements must be minimum... As in above example {9,5,2,6,3,11} where K=3 In case of {2,3,5} 3-2=1 5-3=2 sum of the difference is 3...In all other subsets we cant have sum of the difference less than 3...so {2,3,5} is the required answer.

[algogeeks] Time Complexity

2011-11-18 Thread Ankuj Gupta
What is the time complexity of this code for Level Order Traversal. void printLevel(BinaryTree *p, int level) { if (!p) return; if (level == 1) { cout p-data ; } else { printLevel(p-left, level-1); printLevel(p-right, level-1); } } void printLevelOrder(BinaryTree *root) {