Re: [algogeeks] How will you implement a stack using a priority queue. Push and pop should be in O(1)

2013-05-25 Thread Ankur Khurana
and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. -- Regards, Ankur Khurana Software Developer Engineer, Microsoft India Development Center, Hyderabad. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group

Re: [algogeeks] Re: royal bank of scotland

2011-09-17 Thread Ankur Khurana
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. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You

Re: [algogeeks] Re: Remove all Duplicates Words

2011-08-24 Thread Ankur Khurana
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group

Re: [algogeeks] Doubt

2011-08-21 Thread Ankur Khurana
this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- 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: [algogeeks] C Output

2011-08-14 Thread Ankur Khurana
this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed

Re: [algogeeks] os

2011-08-14 Thread Ankur Khurana
..:( On Sun, Aug 14, 2011 at 9:46 AM, Ankur Khurana ankur.kkhur...@gmail.comwrote: My 2 cents, When the termination signal is sent to the thread either synchronously or asynchronously , you just have a mechanism in place that if that thread is in critical section , it exits from

Re: [algogeeks]

2011-08-14 Thread Ankur Khurana
]; On Sun, Aug 14, 2011 at 9:57 AM, Ankur Khurana ankur.kkhur...@gmail.comwrote: it's a simple dp , ned not be knapsack one. int arr[n]; arr[0]=0 arr[1]=1; for(int i=2;i=n;i++) { arr[i]=arr[i-1]+arr[i-2]; } do you get the code ? i mean , pseudo code was almost similar. On Sun, Aug 14

Re: [algogeeks] Re: an array question

2011-08-14 Thread Ankur Khurana
@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. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received

Re: [algogeeks] Re: an array question

2011-08-14 Thread Ankur Khurana
I think thats the way radix sort will work... Correct me if i m wrong...! On 8/14/11, Ankur Khurana ankur.kkhur...@gmail.com wrote: isn't it a simple question of applying radix sort from most significant to least signigicant digit and concatenating all the sorted numbers to get

Re: [algogeeks] Re: an array question

2011-08-14 Thread Ankur Khurana
cases. Will require extremely good use of pointers. On 14 August 2011 19:16, Ankur Khurana ankur.kkhur...@gmail.com wrote: why will 678 come after 583 ? okay ., sort from least to most significant digit. append imaginary 0's at the end of the numbers with varying length to make them of same

Re: [algogeeks] Memory Leak

2011-08-14 Thread Ankur Khurana
://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- 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

Re: [algogeeks] Re: an array question

2011-08-14 Thread Ankur Khurana
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. -- Ankur Khurana Computer Science Netaji Subhas Institute

Re: [algogeeks] matrix question ???!!!!!!!!!!??????????

2011-08-14 Thread Ankur Khurana
this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed

Re: [algogeeks] os

2011-08-13 Thread Ankur Khurana
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group

Re: [algogeeks] Re: Printing a Number triangle

2011-08-13 Thread Ankur Khurana
@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. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received

Re: [algogeeks]

2011-08-13 Thread Ankur Khurana
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. -- Ankur

Re: [algogeeks] c question

2011-08-13 Thread Ankur Khurana
to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: Printing a Number triangle

2011-08-13 Thread Ankur Khurana
to print from 10 to 7 in the row number 4. here prev will be 6. On Sun, Aug 14, 2011 at 10:05 AM, AASHISH SUMAN aashish.barn...@gmail.comwrote: @ankur what is the need of prev=((i-)*i)/2; On Sun, Aug 14, 2011 at 9:51 AM, Ankur Khurana ankur.kkhur...@gmail.comwrote: see , we can see

Re: [algogeeks] Re: Microsoft :)

2011-08-06 Thread Ankur Khurana
@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. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received

Re: [algogeeks] Re: MS [Written Question]

2011-08-04 Thread Ankur Khurana
@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. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received

Re: [algogeeks] Re: Amazon Aptitude questions

2011-08-04 Thread Ankur Khurana
this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed

Re: [algogeeks] Re: Give an efficient search algo

2011-08-03 Thread Ankur Khurana
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

[algogeeks] Complexity of euclidean theorem to find GCD

2011-08-03 Thread Ankur Khurana
at this result as well. Regards, Ankur Khurana -- 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

Re: [algogeeks] finding element in rotated array

2011-07-30 Thread Ankur Khurana
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. -- Ankur Khurana Computer Science Netaji Subhas Institute

Re: [algogeeks] finding element in rotated array

2011-07-30 Thread Ankur Khurana
above is when the sorted array is in increasing order. On Sat, Jul 30, 2011 at 11:56 AM, Ankur Khurana ankur.kkhur...@gmail.comwrote: low =lower_bound , high=upper_bound; int a=arr[low]; while(lowhigh) { mid=(low+high)/2; if( arr[mid]a midupper_bound arr[mid+1] a) break; //you found

Re: [algogeeks] array constant

2011-07-30 Thread Ankur Khurana
options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

Re: [algogeeks] FB intern

2011-07-30 Thread Ankur Khurana
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. -- Ankur

Re: [algogeeks]

2011-07-30 Thread Ankur Khurana
this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed

Re: [algogeeks] Re: adobe written round que

2011-07-30 Thread Ankur Khurana
. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- 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

Re: [algogeeks] Re: Tug of War

2011-07-30 Thread Ankur Khurana
to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] do while problem

2011-07-29 Thread Ankur Khurana
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. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received

Re: [algogeeks] problem at line number 12

2011-07-29 Thread Ankur Khurana
options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

[algogeeks] C output 3

2011-07-29 Thread Ankur Khurana
Please explain the output, that why is it in that form in hexadecimal form #includestdio.h int main() { printf(%d %x,-11,-11); return 0; } output : -2 fffe -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] problem at line number 12

2011-07-29 Thread Ankur Khurana
+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] problem at line number 12

2011-07-29 Thread Ankur Khurana
@rajeev: your code gives compilation error. On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: no , n[0] is *(n+0) so actually n is being dereferenced here .Check the basci diff p is a pointer , but n is a pointer to a pointer. On Fri, Jul 29, 2011 at 11:34 PM

Re: [algogeeks] problem at line number 12

2011-07-29 Thread Ankur Khurana
http://ideone.com/OaCDR On Fri, Jul 29, 2011 at 11:45 PM, rajeev bharshetty rajeevr...@gmail.comwrote: @ankur :which compiler are u using?? On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: @rajeev: your code gives compilation error. On Fri, Jul 29, 2011

Re: [algogeeks] Programming Puzzle!!!!!!!

2011-07-29 Thread Ankur Khurana
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. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you

Re: [algogeeks] problem at line number 12

2011-07-29 Thread Ankur Khurana
...@gmail.comwrote: @ankur: But the same above code wont show any error on my gcc 4.3.2 running on Open Suse 11.4 On Fri, Jul 29, 2011 at 11:48 PM, Ankur Khurana ankur.kkhur...@gmail.com wrote: http://ideone.com/OaCDR On Fri, Jul 29, 2011 at 11:45 PM, rajeev bharshetty rajeevr

Re: [algogeeks] C output 3

2011-07-29 Thread Ankur Khurana
i figured it out. I didnt know before that is was in 2's complement form . On Fri, Jul 29, 2011 at 11:53 PM, sukhmeet singh sukhmeet2...@gmail.comwrote: I couldn't understand the problem .. u have used %x as indentifier that why it is so On Fri, Jul 29, 2011 at 11:37 PM, Ankur Khurana

Re: [algogeeks] problem at line number 12

2011-07-29 Thread Ankur Khurana
...@gmail.comwrote: @ankur: But the same above code wont show any error on my gcc 4.3.2 running on Open Suse 11.4 On Fri, Jul 29, 2011 at 11:48 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: http://ideone.com/OaCDR On Fri, Jul 29, 2011 at 11:45 PM, rajeev bharshetty rajeevr...@gmail.com

Re: [algogeeks] adobe written round que

2011-07-29 Thread Ankur Khurana
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] adobe written round que

2011-07-29 Thread Ankur Khurana
code...for eg in dis ques only can u tell me how to use itoa to get sum... On Sat, Jul 30, 2011 at 1:13 AM, Ankur Khurana ankur.kkhur...@gmail.comwrote: when you use itoa , what you get is a string. get the sum of all the digits , using c-'0' and then use repeated subtraction . . . On Sat

Re: [algogeeks] finding element in rotated array

2011-07-29 Thread Ankur Khurana
this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed

Re: [algogeeks] finding element in rotated array

2011-07-29 Thread Ankur Khurana
/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- 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] Re: Contiguous subarray with sum zero

2011-07-28 Thread Ankur Khurana
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. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology

Re: [algogeeks] Re: OUTPUT

2011-07-27 Thread Ankur Khurana
/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- 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

[algogeeks] C output 2

2011-07-27 Thread Ankur Khurana
if i declare a string constant inside another function like let us say , int how() { char *s=hello; return s; } so when how() get executed , the memory for hello will remain reserved or it can be allocated to others. Will it amount to memory leak ? -- Ankur Khurana Computer Science Netaji

[algogeeks] C output.

2011-07-26 Thread Ankur Khurana
#includeiostream #includestring.h using namespace std; #define N(e) e#e int main() { int i=1,j=2,k=3; int m = i++ || j++ k++; couti j k m; } output :-2 2 3 1 http://www.ideone.com/0sKBr can anybody explain ? why are ++j and ++k are not evaluating even though operator should be evaluated

Re: [algogeeks] C output.

2011-07-26 Thread Ankur Khurana
than it wont check for the second.Thus j and k are not getting evaluated. On Tue, Jul 26, 2011 at 2:46 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: #includeiostream #includestring.h using namespace std; #define N(e) e#e int main() { int i=1,j=2,k=3; int m = i++ || j++ k

Re: [algogeeks] Re: please help

2011-07-26 Thread Ankur Khurana
email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] xplain output

2011-07-23 Thread Ankur Khurana
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. -- Ankur Khurana Computer Science Netaji Subhas Institute

Re: [algogeeks] Sorting in O(n)

2011-07-22 Thread Ankur Khurana
, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- 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: [algogeeks] Sorting in O(n)

2011-07-22 Thread Ankur Khurana
traverse the list and while updating u do value+min... still it is not suitable if the magnitude is high. On Sat, Jul 23, 2011 at 9:45 AM, Ankur Khurana ankur.kkhur...@gmail.comwrote: n logn merge sort.count sort only when range is known. On Sat, Jul 23, 2011 at 1:35 AM

Re: [algogeeks] Unique characters in a string

2011-07-22 Thread Ankur Khurana
. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- 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: [algogeeks] Re: Adobe Ques

2011-07-21 Thread Ankur Khurana
. 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. -- Ankur Khurana Computer Science Netaji Subhas

Re: [algogeeks] Re: Adobe Ques

2011-07-21 Thread Ankur Khurana
Sorry , solution nahi dekha tha tera maine. On Thu, Jul 21, 2011 at 9:29 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: I gave an O(N) solution in a different thread by same author for this question... On Thu, Jul 21, 2011 at 6:08 PM, Abhi abhi123khat...@gmail.com wrote: My

Re: [algogeeks] Re: Adobe Ques

2011-07-21 Thread Ankur Khurana
but mine was different , check kar liyo On Thu, Jul 21, 2011 at 10:06 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: Sorry , solution nahi dekha tha tera maine. On Thu, Jul 21, 2011 at 9:29 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: I gave an O(N) solution in a different

Re: [algogeeks] Contiguous subarray with sum zero

2011-07-20 Thread Ankur Khurana
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group

Re: [algogeeks] Whats the complexity?

2011-07-20 Thread Ankur Khurana
, 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. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi

Re: [algogeeks] Reverse a List with Recursion

2011-07-17 Thread Ankur Khurana
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. -- Ankur Khurana Computer

[algogeeks] Free memory

2011-07-17 Thread Ankur Khurana
Can we do this ? int i=12; free(i); Regards, Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks

[algogeeks] Re: Free memory

2011-07-17 Thread Ankur Khurana
more generally what is the memory structure of local , global and runtime allocated variable . I guess , runtime allocation is done from memory heap , local goes in to a stack . What about global ? On Sun, Jul 17, 2011 at 2:57 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: Can we do

Re: [algogeeks] Re: Free memory

2011-07-17 Thread Ankur Khurana
also go to the stack.That's how they retain their values during function calls. On Sun, Jul 17, 2011 at 3:02 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: more generally what is the memory structure of local , global and runtime allocated variable . I guess , runtime allocation is done from

Re: [algogeeks] Re: Free memory

2011-07-17 Thread Ankur Khurana
it will give. On Sun, Jul 17, 2011 at 3:09 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: local stack is different and global is different ? and runtime memory is going to memory heap that i know. Saurabh : above snippet does not give runtime error. On Sun, Jul 17, 2011 at 3:04 PM, saurabh

Re: [algogeeks] what would be the output of following code??

2011-07-16 Thread Ankur Khurana
answer for first should be 2 22 23 and for second 2 222 2 correct me if i am wrong. On Sat, Jul 16, 2011 at 3:08 PM, Deoki Nandan deok...@gmail.com wrote: what about this printf(\n%d,printf(%d %d,2,2)printf(%d%d ,2,2)); On Sat, Jul 16, 2011 at 3:04 PM, swetha rahul

Re: [algogeeks] Re: Printf ...

2011-07-16 Thread Ankur Khurana
I am using MinGW compiler (codeblocks , out put is 788 and not 678 . Its compiler dependent so , let us leave it that way only. On Sat, Jul 16, 2011 at 3:27 PM, shiv narayan narayan.shiv...@gmail.comwrote: according to me it processing is done from righ to left .first right most a would

Re: [algogeeks] Merge unsorted arrays

2011-07-16 Thread Ankur Khurana
Use divide and conquer. take 2 array at a time and .so you are merging two array at a time. num_of_list=m; length of list=n; while(num_of_list 1) { while( (num of list where length = length_of_list) 2) { merge two lists of length (length_of_list); } if(num_of_list %2==0) num_of_list/=2; else

Re: [algogeeks] Merge unsorted arrays

2011-07-16 Thread Ankur Khurana
oops , didnt see the unsorted thing. complexity is mnlog(n) + mn log(m) On Sat, Jul 16, 2011 at 4:23 PM, sagar pareek sagarpar...@gmail.com wrote: sort all the arrays first O(nlogn) then use merge sort On Sat, Jul 16, 2011 at 3:43 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: Use

Re: [algogeeks] Re: Merge unsorted arrays

2011-07-16 Thread Ankur Khurana
you sort array before merging. and then use merge sort On Sat, Jul 16, 2011 at 6:53 PM, noobcoder ase.as...@gmail.com wrote: how does ur algo produce sorted elements in final array? On Jul 16, 3:55 pm, Ankur Khurana ankur.kkhur...@gmail.com wrote: oops , didnt see the unsorted thing

[algogeeks] Basic String Queries

2011-07-11 Thread Ankur Khurana
if we are using strncpy( destination , source , num_of_char) then if destination have less space allocated than num_of_char , what will happen ? Also , if there is no null char after string, what will happen , puts(str) //where str is the string wihtout NULL character . I was not able to find

Re: [algogeeks] Spoj-merectcnt

2011-03-20 Thread Ankur Khurana
problem ka link bhi diya karo ya code.. On Sun, Mar 20, 2011 at 3:34 AM, sunny sunny.verma...@gmail.com wrote: hello frnds... i am getting TLE in 12th test case .. can anyone over ther help me to shorten it.. #includestdio.h #includeiostream using namespace std; int gcd(int a, int

Re: [algogeeks] spoj problem

2011-03-15 Thread Ankur Khurana
@utraksh : 10^9 is well in int limits On Tue, Mar 15, 2011 at 12:56 PM, Satyam Kapoor satyamkapoo...@gmail.comwrote: @utkarsh:teri kismat acchi thi aur kuch nhimaze kar! --- Satyam Kapoor B.Tech-2nd Year MNNIT-Allahabad. -- You received this message because

Re: [algogeeks] Brainfuck compiler

2011-03-15 Thread Ankur Khurana
@carl : may be this : https://www.spoj.pl/problems/SBSTR1/ On Tue, Mar 15, 2011 at 9:35 PM, kumar anurag anurag.it.jo...@gmail.comwrote: I used a prgram of c which converts brainfuck program to C progaram which u can compile using gcc On Tue, Mar 15, 2011 at 9:12 PM, Carl Barton

[algogeeks] SPoj maximum sum subseuence

2011-03-12 Thread Ankur Khurana
https://www.spoj.pl/problems/MAXSUMSQ/ Hi in above problem , i am getting TLE but according to given contraints , i think my code is good enough to run. Can any body help me here #include vector #include map #include algorithm #include cstring #include iostream #include cstdio #include cmath

Re: [algogeeks] manually initialise indexing of an array

2011-03-10 Thread Ankur Khurana
may be this will do int arr[21]; int *a; a=arr+10; now a can vary from a[-10] to a[10] I have doubts but will this work ? On Thu, Mar 10, 2011 at 3:31 PM, amit amitthecoo...@gmail.com wrote: Indexing of an array starts with '0' by default. can we manually start with 1 or any other number say

Re: [algogeeks] printing without loop

2011-03-01 Thread Ankur Khurana
simply use GOTO On Tue, Mar 1, 2011 at 3:40 PM, vaibhav shukla vaibhav200...@gmail.comwrote: write printf statemen 100 times. lolzzz On Tue, Mar 1, 2011 at 2:01 PM, Subhransu subhransu.panigr...@gmail.comwrote: Hey Guys, @preetikatyagi : The question is pretty straight Write a

Re: [algogeeks] making a graphical c++ programme

2011-02-26 Thread Ankur Khurana
What is your primary purpose . If you want to make a game , OpenGL and AllegroGL is way to go .Other wiase to make appliations , you can use visual c++. Can you be more specific ? Regards, Ankur On Sat, Feb 26, 2011 at 1:22 PM, Logic King crazy.logic.k...@gmail.comwrote: I also want to know

Re: [algogeeks] CODECHEF FLIP COIN problem

2011-02-08 Thread Ankur Khurana
try lazy propogation On Tue, Feb 8, 2011 at 8:14 PM, Gaurav Saxena grvsaxena...@gmail.comwrote: Hey thanks for your help I have written a code using range trees but I am still getting TLE [?][?][?] Please suggest me something Here is my code /* * File: main1.c * Author: gs * *

Re: [algogeeks] SUMMER INTERNSHIP

2011-01-09 Thread Ankur Khurana
somebody might enlighten for 3rd year as well (INDIA) On Sun, Jan 9, 2011 at 6:53 PM, abhishesh srivastava abhishesh.srivast...@gmail.com wrote: Can anyone please tell me about the summer internship programs of various institute. I want to know how to register and about various summer

[algogeeks] double and int

2011-01-06 Thread Ankur Khurana
in a C++ program , when we have something like this double p=37.0; int k; k=(int)p; why is k!=p ? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this

Re: [algogeeks] Re: double and int

2011-01-06 Thread Ankur Khurana
not always. well , i got some problem using that approachwhen the output is coming out of some library function , this doesn't qualify always i wlll find an example by tomorrow. On Thu, Jan 6, 2011 at 11:48 PM, juver++ avpostni...@gmail.com wrote: On my computer k == p. -- You received this

Re: [algogeeks] Adobe Question

2011-01-04 Thread Ankur Khurana
will an o(n^2) do ? , i have one in mind but will that suffice ? anyways , here it goes make array a[array_length][2]; a[k][0] and a[k][1] will contain the no. of 0's and 1 till kth position. just iterate twice to see where a[i][0]-a[j][0]==a[i][1]-a[j][1] can be maximized . meanwhile i am

Re: [algogeeks] Puzzle Will Stuck

2011-01-04 Thread Ankur Khurana
it's exactly the same question as Buttons on codechef. search this forum , it have been discussed before On Tue, Jan 4, 2011 at 4:13 PM, bittu shashank7andr...@gmail.com wrote: There is a lock which is an N by N grid of switches. Each switch can be in one of two states (on/off). The lock is

Re: [algogeeks] Divide an array into two equal subsets

2010-12-29 Thread Ankur Khurana
...@gmail.com wrote: Sum up all the number and divide by 2 Using the algorithm subset problem to find a number close to median Wladimir Araujo Tavares Federal University of CearĂ¡ On Wed, Dec 29, 2010 at 2:07 PM, Ankur Khurana ankur.kkhur...@gmail.com wrote: How will you divide and array

Re: [algogeeks] Amazon Question

2010-12-26 Thread Ankur Khurana
are we given range of numbers ? On Sun, Dec 26, 2010 at 4:39 PM, bittu shashank7andr...@gmail.com wrote: You are provided with a stream of numbers, design a data structure to store the numbers in the stream along with their no. of occurrences. Regards Shashank Mani -- You received this

Re: [algogeeks] Amazon Question

2010-12-26 Thread Ankur Khurana
i think if it given , can we consider a hash table ? On Sun, Dec 26, 2010 at 4:39 PM, Ankur Khurana ankur.kkhur...@gmail.com wrote: are we given range of numbers ? On Sun, Dec 26, 2010 at 4:39 PM, bittu shashank7andr...@gmail.com wrote: You are provided with a stream of numbers, design a data

Re: [algogeeks] Amazon Question

2010-12-26 Thread Ankur Khurana
may be we can assume that klog(n) else i dont see a way out than hashing , because that is the only thing less that log(n). On Sun, Dec 26, 2010 at 6:37 PM, mohit ranjan shoonya.mo...@gmail.com wrote: hmm.. ok let me try to explain my point... suppose in stream, the rate is 1 integer/k time,

Re: [algogeeks] Re: convert binary matrix to zero matrix

2010-12-25 Thread Ankur Khurana
i have devised another apporah for same but i would have liked to understand what terence has said ? On Sat, Dec 25, 2010 at 3:01 PM, Ankur ankur.kkhur...@gmail.com wrote: when you are talking abt starting from 1 that means that array is 1 based , right ? and how did you get the steps

[algogeeks] Codechef

2010-12-24 Thread Ankur Khurana
I have solved this problem , but i need test cases for this as it it giving WA in online judge. i dont want algo , but if anyone have solved this, please provide with some random test cases or one or two corner test cases. i will be greatful. http://www.codechef.com/problems/ARRAYTRM Given n

Re: [algogeeks] how to delete a substring from a given string.???

2010-12-23 Thread Ankur Khurana
you can use direct c++ tem-plates. anyways , in c format. use strstr() to find the pointer to the substring present in the main given string. then just shift all the contents after the subtring to the starting of your substring. On Thu, Dec 23, 2010 at 3:47 AM, Ajay Kumar ajay...@gmail.com

Re: [algogeeks] Re: Array Ranking Problem

2010-12-23 Thread Ankur Khurana
it is just like 0/1 knapsack problem with maximum weight of knapsack as 40. but in this case that is minimum that we have to calculate. calculate marks/time for every element . then try finding the elements with max value/time to fulfill the quota of marks. i dont know if this can be done in O(n)

Re: [algogeeks] Re: Array Ranking Problem

2010-12-23 Thread Ankur Khurana
:08 PM, Ankur Khurana ankur.kkhur...@gmail.com wrote: it is just like 0/1 knapsack problem with maximum weight of knapsack as 40. but in this case that is minimum that we have to calculate. calculate marks/time for every element . then try finding the elements with max value/time to fulfill

Re: [algogeeks] Re: Array Ranking Problem

2010-12-23 Thread Ankur Khurana
i will try to elaborate or rewrite tat part On Thu, Dec 23, 2010 at 10:25 PM, Ankur Khurana ankur.kkhur...@gmail.com wrote: wverything i mentioned above can be done in O(n) but sorting part is nlogn . so that is what i was saying. can you specify where i was not clear ? On Thu, Dec 23, 2010

Re: [algogeeks] Re: Array Ranking Problem

2010-12-23 Thread Ankur Khurana
not exceeding (Total Score - Pass Score), while maximize the sum of time of the subset. So I do not think O(nlogn) greedy algorithm will solve this problem. On 2010-12-23 23:38, Ankur Khurana wrote: it is just like 0/1 knapsack problem with maximum weight of knapsack as 40. but in this case

Re: [algogeeks] Re: difference x

2010-12-22 Thread Ankur Khurana
@snehal : nothing wrong in what saurabh said. it was just that if you are posting a question , then you should also post the approach you have thought.plus you are posting in bulk . so , please whenever you give a question , also mention your approach. it gives greater confidence in question to be

Re: [algogeeks] Re: difference x

2010-12-22 Thread Ankur Khurana
. On Wed, Dec 22, 2010 at 10:04 PM, Ankur Khurana ankur.kkhur...@gmail.com wrote: @snehal : nothing wrong in what saurabh said. it was just that if you are posting a question , then you should also post the approach you have thought.plus you are posting in bulk . so , please whenever you

Re: [algogeeks] Re: difference x

2010-12-22 Thread Ankur Khurana
saurabh , asking for a better sol. is not a crime. rest everybody is intelligent. On Wed, Dec 22, 2010 at 10:27 PM, Saurabh Koar saurabhkoar...@gmail.com wrote: @Snehal: I hv no problem wid ur doubts.Bt sometimes u post probs which r very basic.As u solved the looping prob in other thread I

Re: [algogeeks] HP Question

2010-12-21 Thread Ankur Khurana
insertion sort in IMHO On Tue, Dec 21, 2010 at 5:44 PM, bittu shashank7andr...@gmail.com wrote: Which one is the efficient sorting technique for arranging the books in a library? a) Bubble Sort b) Selection Sort c) Insertion Sort d) Heap Sort Regards Shashank -- You received this

Re: [algogeeks] Re: Adobe Interview Question

2010-12-21 Thread Ankur Khurana
ashish , nobody is fighting here , but are u sure you are clear on your probability concepts ? independent events do multiply . what is the probability that when we toss three coins , we get all three heads ? On Tue, Dec 21, 2010 at 6:45 PM, Ashish Goel ashg...@gmail.com wrote: Dear Shashank

Re: [algogeeks] Re: Adobe Interview Question

2010-12-21 Thread Ankur Khurana
...@gmail.com wrote: this is not probability purely...there is an else in between :) why don't you write the program and test it out yourself :) Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Tue, Dec 21, 2010 at 6:52 PM, Ankur Khurana ankur.kkhur

  1   2   >