[algogeeks] Manufacturing equal length poles from given Rods

2017-12-10 Thread pankaj joshi
00. Ex: N=6 K: 1 3 2 6 4 Sol: 1 3 4 pole1 6 2 Pole2 Thanks Pankaj -- Regards, Pankaj Kumar Joshi -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To unsubscribe from this group and stop receiving emails

Re: [algogeeks] variation of LIS problem

2013-10-24 Thread pankaj joshi
an email to algogeeks+unsubscr...@googlegroups.com. -- Regards, Pankaj Kumar Joshi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr

Re: [algogeeks] variation of LIS problem

2013-10-24 Thread pankaj joshi
will be {10,30,55} and if k is 4 than {5, 10, 30 , 55) On Thu, Oct 24, 2013 at 6:20 PM, Saurabh Paliwal saurabh.paliwa...@gmail.com wrote: You must be mistaken in the definition of heaps, or maybe the question, look at the updated question I put up there. On Thu, Oct 24, 2013 at 5:48 PM, pankaj

Re: [algogeeks] variation of LIS problem

2013-10-24 Thread pankaj joshi
is checked by condition, not by Min-heap, but min heap is used for storing the largest elements. So it is preferable DS, On Thu, Oct 24, 2013 at 8:35 PM, atul anand atul.87fri...@gmail.com wrote: @pankaj : how can you maintain increasing sub-sequence using heapyour soln is for finding finding K

Re: [algogeeks] variation of LIS problem

2013-10-24 Thread pankaj joshi
should be using max-heap not min-heap. check your algo for :- 1,2,5,10,100,30,8,555 let me know if it work fine.If it is working fine then i need more clarity of your algo On 10/24/13, pankaj joshi joshi10...@gmail.com wrote: @Saurabh: As per the question the elements of sub-sequence

[algogeeks] Need an optimized solution.

2013-10-17 Thread pankaj joshi
take care of space also. K=N=109 1=K=1 Regards, Pankaj Kumar Joshi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com.

Re: [algogeeks] Re: Array of intergers with repeating elements

2013-05-10 Thread pankaj joshi
. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. -- Regards, Pankaj Kumar Joshi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop

Re: [algogeeks] Re: Amazon interview question

2013-04-13 Thread pankaj joshi
://groups.google.com/groups/opt_out. -- Regards, Pankaj Kumar Joshi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more

[algogeeks] Re: Openings in Amazon

2012-11-27 Thread Pankaj Kumar
Sir, I have sent you my CV on vivekr...@gmail.com. Hope you got that On Friday, November 23, 2012 9:29:29 PM UTC+5:30, Vivek Ramamurthy wrote: Hi, Amazon is hiring people for software development projects undergoing at Blore, Hyd and Chennai divisions.There are openings for Software

Re: [algogeeks] Re: amazon ques

2011-12-29 Thread pankaj agarwal
same question as above with one more task is given 4) FindAnyElement() which will return any element present in that structure with O(1). for given all 4 task Please suggest which Data Structure is better now...? Best Regards, Pankaj Agarwal -- You received this message because you

Re: [algogeeks] Suggest Algo: OffCampus Apple Interview Question

2011-11-30 Thread Pankaj Tiwari
for any value of x. -- Pankaj On Wed, Nov 30, 2011 at 12:45 PM, atul anand atul.87fri...@gmail.comwrote: @nitin : as mentioned in the subject , its for Apple BTW @siddharth , i did not understand your question . little more explanation please. On Mon, Nov 28, 2011 at 7:14 PM, Nitin Garg

[algogeeks] AMDOCS

2011-09-23 Thread pankaj saikia
hii Any help or suggestions is greatly welcome for AMDOCS interview..i have gone through the archives but it was not much helpful. thanks in advance. Pankaj Saikia -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-21 Thread pankaj agarwal
- P(i) P(i-1) for all i = k To prove P(k+1) P(k) Proof P(k+1) - P(k) = (P(k) - P(k-6))/6 0 -- Pankaj Agarwal Communication and Computer Engineering LNMIIT,jaipur -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

[algogeeks] runtime error help

2011-08-14 Thread pankaj kumar
can any one help me why am i getting runtime error in the program. my program is def call(a,b): print(((pow(a,b))%10)); def main(): n=input(); for x in range(n): import sys a,b = map(long,sys.stdin.readline().split());

[algogeeks] pankaj kumar wants to chat

2011-08-14 Thread pankaj kumar
--- pankaj 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-fec58d8386-f16dcef73c-qIhM6BVo3OJNdgYKy2viERCQNpE You'll

Re: [algogeeks] Re: Link list problem..

2011-08-08 Thread pankaj kumar
if doubly link list then it is possible to insert a new node before the current pointer. -- 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

Re: [algogeeks] MICROSOFT INTERVIEW QUESTIONS faced by my frenz nd me

2011-08-08 Thread pankaj kumar
5)program will compile and ans is 2 3 5 6 -- 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.

Re: [algogeeks] amazon test question!!!

2011-08-08 Thread pankaj kumar
what's 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+unsubscr...@googlegroups.com. For more options, visit this

[algogeeks] OT- Latest C++ primer edition.

2011-08-07 Thread Pankaj
I have been trying to find it on net in *pdf* format but unsuccessful. Online bookstore link will do with reasonable rate :) or If anyone can share the pdf link. Cheers Pankaj -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] Directi Question

2011-08-06 Thread Pankaj
There are two cases: First if we get even number in first roll. So P(A)= 1/2 And if We get odd number in second roll, then we need keep rolling untill we find another odd number. So, (1/2)*[1/2] + 1/2*1/2*1/2 upto infinity. On Sat, Aug 6, 2011 at 8:46 PM, Nitin Gupta

Re: [algogeeks] Directi Question

2011-08-06 Thread Pankaj
Sorry, I mis understood the ques. On Sat, Aug 6, 2011 at 8:56 PM, Pankaj jatka.oppimi...@gmail.com wrote: There are two cases: First if we get even number in first roll. So P(A)= 1/2 And if We get odd number in second roll, then we need keep rolling untill we find another odd number. So, (1

Re: [algogeeks] simple doubt

2011-08-05 Thread pankaj kumar
first one is right and second is wrong.because dp will store address of pointer and here you are storing address of int array. -- 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

Re: [algogeeks] Structure Q

2011-08-05 Thread pankaj kumar
head-x=100 is not right if you will first declare head=new list; head-x=100; will be right. -- 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

Re: [algogeeks] Re: Duplicates in a string

2011-08-05 Thread pankaj kumar
int b[26]={0}; vectorcharc; for(i=0;a[i];i++) { if(!b[(a[i]-65)]) { b[(a[i]-65)]++; c.push_back(a[i]); } } for(i=0;ic.size();i++) coutc[i]; } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Re: Duplicates in a string

2011-08-05 Thread pankaj kumar
when you encounter the letter for first time then simply increment array having index=(ASCII value-65) and put that in vector next time when you will encounter the same variable again then condition will fail hence no change in content of vector hence in the end simply print the vector -- You

Re: [algogeeks] Makemytrip.com

2011-08-05 Thread pankaj kumar
coming for which branch?? -- 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,

Re: [algogeeks] help with stringstream (STL)

2011-08-03 Thread Pankaj
http://ideone.com/FtfQO On Thu, Aug 4, 2011 at 2:54 AM, Victor Manuel Grijalva Altamirano kavic1.mar...@gmail.com wrote: Hi, i don't know how to use stringstream of STL, if i have the string a=helloawordagoodabye, i need the next list: hello word good bye check that for each 'a' i need

Re: [algogeeks] Sort IT

2011-08-02 Thread pankaj kumar
int a[N^2]={0},i,j; for(i=0;iN^2;i++) { cinj; a[j]++; } for(i=0;iN^2;i++) { if(a[i]!=0) { while(a[i]--) { couti\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

Re: [algogeeks] Amazon

2011-07-30 Thread pankaj kumar
what was cutoff cgpa for amazon?? -- pankaj kumar -- 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] direct i

2011-07-27 Thread Pankaj
Even in array best case can be O(n). Why use stack? On Wed, Jul 27, 2011 at 12:14 PM, salvador_cerinza vishwakarma.ii...@gmail.com wrote: Best case : O(n) Worst case : O(n^2) can be done using stack. Thinking of better solution. . On Wed, Jul 27, 2011 at 11:50 AM, ankit sambyal

Re: [algogeeks] direct i

2011-07-27 Thread Pankaj
, 2011 at 12:16 PM, Pankaj jatka.oppimi...@gmail.comwrote: Even in array best case can be O(n). Why use stack? On Wed, Jul 27, 2011 at 12:14 PM, salvador_cerinza vishwakarma.ii...@gmail.com wrote: Best case : O(n) Worst case : O(n^2) can be done using stack. Thinking of better solution

Re: [algogeeks] direct i

2011-07-27 Thread Pankaj
6.if step 4 is true , the push val in stack S and all elements which were popped in the order they were popped except the last matched candidate element. Yeah..dis algo is not very efficient.. On Wed, Jul 27, 2011 at 12:20 PM, Pankaj jatka.oppimi...@gmail.comwrote: Can you please elaborate

Re: [algogeeks] C OUTPUT

2011-07-25 Thread Pankaj
Will not it depend on whether the machine is big or little endian? On Mon, Jul 25, 2011 at 11:50 AM, rajeev bharshetty rajeevr...@gmail.comwrote: 257 is stored as B A 0001 0001 So iptr if int* will be pointing to this

[algogeeks] Amazon- Most Common Three sequence

2011-07-25 Thread Pankaj
You have a Log file that stores the users id, time(irrelevant), and webpage visited. Find the most common three-sequence webpage visited by the users. For example, you have a log file joe, 12:30pm,home joe, 12:31pm,about joe, 12:32pm,career james, 12:35pm, home james, 12:36pm, cart james,

Re: [algogeeks] Re: stacks

2011-07-23 Thread Pankaj
Can you please tell us from where we can find such questions? On Sat, Jul 23, 2011 at 4:21 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote: Nice question Kamakshi. The person above has given almost a perfect answer. For example i=3, we will pop the elements one by one from the top of the 1st

Re: [algogeeks] output plzz

2011-07-23 Thread Pankaj
+1. The new group should only contain stuff related to C output and error detection and ques like that. Puzzles I think can be discussed here. wattsay? On Sat, Jul 23, 2011 at 10:44 PM, saurabh singh saurab...@gmail.com wrote: Anyways just share the link on the group.I am pretty sure the

Re: [algogeeks] Re: Shooters in a circle

2011-07-22 Thread Pankaj
N people are standing in a circle ,they start shooting the person standing *next to their neighbour.*If they start firing in this way , determine who will be alive after this sequence?? Just for confirming, if only 2 person are left, then out of guilt of killing other's does the person who has

Re: [algogeeks] Re: Largest substring with unique characters

2011-07-22 Thread Pankaj
Vaibhav What do you thing the complexity of your algo is. And once you hit an duplicate, from where will you start again? On Fri, Jul 22, 2011 at 7:21 PM, vaibhavmitta...@gmail.com wrote: String is abcded l =0, h = 0 i = 1, l = 0, h = 1, max = 1, A[a]=1 i = 2, l = 0, h = 2, max = 2, A[b] = 2

Fwd: [algogeeks] Re: Largest substring with unique characters

2011-07-22 Thread Pankaj
of a better solution then please reply. Cheers Pankaj On Fri, Jul 22, 2011 at 7:37 PM, Pankaj jatka.oppimi...@gmail.com wrote: Vaibhav What do you thing the complexity of your algo is. And once you hit an duplicate, from where will you start again? On Fri, Jul 22, 2011 at 7:21 PM

Re: [algogeeks] Interview Puzzle - 100 Prisoners and Caps

2011-07-22 Thread Pankaj
In my latest interview I encountered the following puzzle. There are 100 prisoners in the prison. All of them have either black or white cap. Jailer has asked them to stand in the queue such that nth guy can see caps of all the guys standing ahead of him, but he can not see his own cap. It

Re: [algogeeks] Interview Puzzle - 100 Prisoners and Caps

2011-07-22 Thread Pankaj
Skipp Riddle, Yes. 100th prisoner will risk his life. Similar puzzle was discuss recently. Does anyone remember the name or thread? ~ Pankaj On Fri, Jul 22, 2011 at 7:55 PM, SkRiPt KiDdIe anuragmsi...@gmail.comwrote: Worst case 99 get released. Is that correct..? -- You received

Re: Fwd: [algogeeks] Re: Largest substring with unique characters

2011-07-22 Thread Pankaj
. On , Pankaj jatka.oppimi...@gmail.com wrote: VaibhavWhat do you think the complexity of your algo is. And once you hit an duplicate, from where will you start again? Try for this example abcdeaifjlbmnodpq. It will be still O(26*n) as at max, we would have to start from each letter and go

Re: Re: Fwd: [algogeeks] Re: Largest substring with unique characters

2011-07-22 Thread Pankaj
Vaibhav Mittal Computer Science Netaji Subhas Institute Of Technology Delhi. On , Pankaj jatka.oppimi...@gmail.com wrote: abcdeaifjlbmnodpq For this once you encounter a at 6th position, You can update your max.Now You will have to do following operation. First clear all the hash. 2. You

Re: [algogeeks] Interview Puzzle - 100 Prisoners and Caps

2011-07-22 Thread Pankaj
Chetan, No. How could you relate this problem with that? Do you find something similar? ~ Pankaj On Fri, Jul 22, 2011 at 8:01 PM, chetan kapoor chetankapoor...@gmail.comwrote: josehus problem??? On Fri, Jul 22, 2011 at 7:57 PM, Pankaj jatka.oppimi...@gmail.com wrote: Skipp Riddle, Yes

Re: Fwd: [algogeeks] Re: Largest substring with unique characters

2011-07-22 Thread Pankaj
Of Technology Delhi. On , Pankaj jatka.oppimi...@gmail.com wrote: Vaibhav, Ok write your code and paste on ideone. It should be easy and quick to code :) On Fri, Jul 22, 2011 at 7:59 PM, vaibhavmitta...@gmail.com wrote: U hv got my algo completely wrong. Gimme a smaller

Re: [algogeeks]

2011-07-22 Thread Pankaj
Just like you do for int * int *p=(int *) malloc(sizeof(int)); double *ptr_lf = (double *) malloc(sizeof(double)); On Sat, Jul 23, 2011 at 12:32 AM, hurtlocker bhavesh24...@rediffmail.comwrote: how to allocate memory for a double pointer ..?? -- You received this message because you are

Re: [algogeeks]

2011-07-22 Thread Pankaj
double **p= (double **) malloc(sizeof(double *)); On Sat, Jul 23, 2011 at 12:40 AM, Bhavesh agrawal agr.bhav...@gmail.comwrote: double pointer mean like **p hoe to allocate memory for this -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks]

2011-07-22 Thread Pankaj
https://ideone.com/tr3Q7 On Sat, Jul 23, 2011 at 12:42 AM, Pankaj jatka.oppimi...@gmail.com wrote: double **p= (double **) malloc(sizeof(double *)); On Sat, Jul 23, 2011 at 12:40 AM, Bhavesh agrawal agr.bhav...@gmail.comwrote: double pointer mean like **p hoe to allocate memory

Re: [algogeeks] Re: Circular list

2011-07-22 Thread Pankaj
If you know circular list, what is avoiding you from maintaining a tail pointer. You just need to tweak insert and delete function a little bit for corner cases. On Sat, Jul 23, 2011 at 12:50 AM, rShetty rajeevr...@gmail.com wrote: Algorithm Please ... Thank You On Jul 23, 12:17 am, vaibhav

Re: [algogeeks]

2011-07-22 Thread Pankaj
int. And assigning the address of each array to memory allocated above. Please let me know if I am wrong. On Sat, Jul 23, 2011 at 12:59 AM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: @rakib:can u please explain ur answer On Sat, Jul 23, 2011 at 12:48 AM, Pankaj jatka.oppimi

Re: [algogeeks] Re: Circular list

2011-07-22 Thread Pankaj
then be the insertion of a node be done in constant time without traversing the list ?? On Jul 23, 12:26 am, Pankaj jatka.oppimi...@gmail.com wrote: If you know circular list, what is avoiding you from maintaining a tail pointer. You just need to tweak insert and delete function a little bit

Re: [algogeeks] Sorting in O(n)

2011-07-22 Thread Pankaj
For linklist? How On Sat, Jul 23, 2011 at 1:23 AM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: use counting sort.. On Sat, Jul 23, 2011 at 1:22 AM, rShetty rajeevr...@gmail.com wrote: How to sort Linked lists in O(n) time ?? Give the algorithm or the explanation or clue to tackle the

Re: [algogeeks] Shooters in a circle

2011-07-21 Thread Pankaj
int n,temp,pow2=1; cinn; temp=n; while(temp){ if(temp%2==) n-=pow2; pow2*=2; temp=temp/2; } On Thu, Jul 21, 2011 at 2:08 PM, Vivek Srivastava srivastava.vivek1...@gmail.com wrote: I forgot to mention that you have to program the problem in any language of your choice.But C will be

Re: [algogeeks] Shooters in a circle

2011-07-21 Thread Pankaj
Ingore the above code. It is wrong. On Thu, Jul 21, 2011 at 2:39 PM, Pankaj jatka.oppimi...@gmail.com wrote: int n,temp,pow2=1; cinn; temp=n; while(temp){ if(temp%2==) n-=pow2; pow2*=2; temp=temp/2; } On Thu, Jul 21, 2011 at 2:08 PM, Vivek Srivastava srivastava.vivek1

Re: [algogeeks] Re: Circle Circle more Circles .........

2011-07-20 Thread Pankaj
http://www.codechef.com/FEB10/problems/M5/ On Wed, Jul 20, 2011 at 5:35 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: @Dumanshu..i am not partitioning them into just two queues... Moreover I just gave a raw idea...and yeah the complexity is in the order of n^2 only. There are many

[algogeeks] Contiguous subarray with sum zero

2011-07-20 Thread Pankaj
Given an array with + and - numbers, including zero, Write an algorithm to find all the possible sub arrays which sum up to zero. For example, if given array is 20 , -9 , 3 , 1, 5 , 0, -6 , 9 Then possible sub arrays are: -9, 3, 1, 5 0 1, 5, 0, -6 -- You received this message because you are

Re: [algogeeks] Output

2011-07-20 Thread Pankaj
I think sunny meant that in IA-64 the pointer is of size 8 but here we are assigning it to int *p. So, the segfault can occur. On Wed, Jul 20, 2011 at 6:52 PM, Sandeep Jain sandeep6...@gmail.com wrote: @Sunny: I couldn't understand how size of int int* matter here?? Regards, Sandeep Jain

Re: [algogeeks] Re: Ever growing sorted linked list

2011-07-20 Thread Pankaj
One a not so standard way of doing that is while creating the link list, keep an extra pointer in the node to point to the jump location. Just hold the previous node in a temp say address of 2 node and when i/p reaches 4, point the jumper pointer to 4 and make 4 the next jumper pointer. On

Re: [algogeeks] Re: Contiguous subarray with sum zero

2011-07-20 Thread Pankaj
*Contiguous elements* On Thu, Jul 21, 2011 at 12:12 AM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: for the above example,there are more possible sub arrays like -9,9 -9,0,9 On Thu, Jul 21, 2011 at 12:06 AM, sagar pareek sagarpar...@gmail.comwrote: @ankur pls explain through an

[algogeeks] Re: Facebook Interview Question....Heavy Number

2011-04-25 Thread pankaj do it
best approach for such problems is try to solve for very small numbers then do DP for solve large numbers. as follows single digit = 7,8,9 answer = 3 [i am taking 7 inclussive] double digit= 7*2 = 14. now smallest number can be. 59=1 68, 69 = 2 77 78, 79,=3 86, 87, 88, 89=4 95,96,97,98,99 =5 3

Re: [algogeeks] C puzzle

2011-04-07 Thread pankaj agarwal
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. -- Pankaj Agarwal

Re: [algogeeks] [brain teaser ] 7march

2011-03-08 Thread pankaj agarwal
i hope statement is- i am telling lie if i don't get a gold coin. clear me if i am wrong On Mon, Mar 7, 2011 at 5:59 PM, amit singh amit.lu...@gmail.com wrote: i will get a gold coin or i will not get a coin On Mon, Mar 7, 2011 at 1:41 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *Get

[algogeeks] Invitation for Online programming competition DOPE

2011-02-15 Thread pankaj do it
Hello, we like to invite you all to participate in Online Programming Contest organized as a part of Daksh 2011, an international level Technical festival of SASTRA University, Thanjavur, Tamilnadu We have two competitions: 1) DOPE Dope is a 6 hour ACM ICPC style algorithmic competition with team

[algogeeks] Re: Simple Question about simple algorithm

2006-06-12 Thread Pankaj Dekate
Hi , here goes the code.. let's say you have an array of n numbers.Here n could be 1,2,3.. it goes as follows: function bubblesort (A : list[1..n]) { var int i, j; for i from n downto 1 { for j from 1 to i-1 { if (A[j] A[j+1]) swap(A[j],