[algogeeks] Openings for freshers, experienced guys For Juniper Networks..

2017-02-09 Thread Piyush Jain
We have openings at Juniper Networks for Freshers & experienced guys. Email me your resume at piyushj at gmail.com Regards, Piyush Jain -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To unsubscribe from this group and

Re: [algogeeks] Distributed System problem

2015-01-14 Thread Piyush Grover
to algogeeks+unsubscr...@googlegroups.com. -- Piyush Grover *Be a traveler, not a tourist* -- 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] Book - COMPETITIVE PROGRAMMING - Increasing the Lower Bound of Programming Contests

2014-01-05 Thread Piyush Jain
Hi, Do you have a copy of competitive programming 2? Please share Regards, Piyush On Wed, Aug 24, 2011 at 7:24 AM, Cleber Adriani da Costa cleberadri...@gmail.com wrote: Hi guys, anyone have the link of the book COMPETITIVE PROGRAMMING *Increasing the Lower Bound of Programming

[algogeeks] Group buy in programming interview/Algorithm books...

2014-01-04 Thread Piyush Jain
Anyone interested in group booking of books? I was thinking about these books: Cracking Programming Interviews 350 Questions with Solutions by Sergei Nakariakov Effective Coding Interviews: Problems and Solutions Jian Lee Programming Algorithms: Problems and Solutions Lin Quan Top 10 coding

Re: [algogeeks] optimization problem - N floors , N persons. minimum number of lift movements to move all persons in their respective floors

2013-05-31 Thread Piyush Grover
The problem is an array sorting problem. You are given an array of size N containing values 1 to N only. Sort it in O(N). Start from floor 1 till ith floor until you find a person on the wrong floor, take him to his respective floor take the guy from that floor and take him to his respective

[algogeeks] SPOJ- MPILOT WA on 10th TEST FILE

2013-05-12 Thread Piyush Raman
I have been trying to solve this problem using DP. i managed to realize the problem in the form of recurrence.. The solution is: Suppose the task was : given N pilots you have to assign N/2 of them as captains and N/2 as assistances. Furthermore you need to do this in a way such that for every

Re: [algogeeks] SPOJ- MPILOT WA on 10th TEST FILE

2013-05-12 Thread Piyush Raman
/12 Piyush Raman piyush2011...@gmail.com I have been trying to solve this problem using DP. i managed to realize the problem in the form of recurrence.. The solution is: Suppose the task was : given N pilots you have to assign N/2 of them as captains and N/2 as assistances. Furthermore you need

[algogeeks] Clustering set problem

2013-04-19 Thread Piyush Grover
failed jobs) that can not be used in further iterations So basically the problem needs to be optimized on two aspects, minimizing costs and maximizing the number of jobs to be executed. Regards Piyush -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

[algogeeks] Re: Clustering set problem

2013-04-19 Thread Piyush Grover
, Piyush Grover piyush4u.iit...@gmail.comwrote: I have a practical problem, need an optimal solution for this *What is given?* Given *N* sets, each containing some jobs to be executed, such that no two sets are subsets of each other and number of jobs in *i-th* set is *ni N*. The jobs can have

Re: [algogeeks] size of array

2013-01-31 Thread Piyush
it will always work if array is statically allocated Not if dynamically allocated, say using malloc etc. On 30-Jan-13 1:55 PM, Prem Krishna Chettri wrote: @Piyush .. Never works.. @All there is no way to do the given requirement in pure C. On Wed, Jan 30, 2013 at 1:45 PM, Piyush piyush.to

Re: [algogeeks] size of array

2013-01-30 Thread Piyush
sizeof(array)/sizeof(array[0]) On 28-Jan-13 3:44 PM, Anil Sharma wrote: How to calculate the size/lenght of an int array which is passed as an ONLY argument to a function??? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Re: Generating mazes

2013-01-29 Thread Piyush Grover
@Don can you give the logic of your rnd() function? -- 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 options,

Re: [algogeeks] Re: Find all words in given character Matrix

2013-01-18 Thread Piyush
On 18-Jan-13 1:57 PM, Sairam wrote: Is it that all characters in a row, column and diagnol should be considered? For example a b c d c a t d In this is cat a valid word? yes -- i will elaborate more e b a t m e m o valid words bat at be to am me memo print them, not required

[algogeeks] Find all words in given character Matrix

2013-01-17 Thread Piyush
Given a MxN char array matrix, find all words in it. search left, right, diagonally --

Re: [algogeeks] Re: Find all words in given character Matrix

2013-01-17 Thread Piyush
:33 pm, Piyush piyush.to...@gmail.com mailto:piyush.to...@gmail.com wrote: Given a MxN char array matrix, find all words in it. search left, right, diagonally -- -- --

[algogeeks] SPOJ-NWERC11A TLE

2013-01-16 Thread Piyush Raman
http://www.spoj.com/problems/NWERC11A/ I have been trying to solve this problem but am getting TLE for larger inputs. Can't come up with an optimal approach!! --

Re: [algogeeks] Pointers Usage

2013-01-12 Thread Piyush Raman
For simple reasons according to me: 1- It reduces overhead drastically,thus more efficient execution time is achieved. Consider a recursive function call having array parameters - func (int a[100][100], int b[100][100]).. Now instead if we use pointers- func(int **a, int **b), the overhead on the

Re: [algogeeks] Re: sortin 2D array

2013-01-12 Thread Piyush Raman
Use a set ADT ( C++ STL). Traverse the entire 2d matrix and keep on adding each element to the set. The set ADT stores, sorts and removes redundant data values and you get sorted list after traversal. Now again traverse the set ADT and store it in an array. On Wed, Jan 9, 2013 at 4:53 PM,

Re: [algogeeks] Re: can we check a number has last digit 5 or not using bitwise operator.

2012-10-13 Thread Piyush Grover
The number which has 5 as last digit can be written as n = 4*a + b where b = 1 or 3 so if 4*a + 1 == n or 4*a + 3 == n; then n has 5 as a last digit. So code looks like: void main() { int n, m; scanf(%d, n); m = 2; m = 2; if(add(m, 1) == n || add(m,3) == n) puts(yes); else puts(no); }

Re: [algogeeks] Re: can we check a number has last digit 5 or not using bitwise operator.

2012-10-13 Thread Piyush Grover
forgot to assign: m = n; On Sun, Oct 14, 2012 at 2:27 AM, Piyush Grover piyush4u.iit...@gmail.comwrote: The number which has 5 as last digit can be written as n = 4*a + b where b = 1 or 3 so if 4*a + 1 == n or 4*a + 3 == n; then n has 5 as a last digit. So code looks like: void main

[algogeeks] Re: puzzle

2012-08-11 Thread Piyush
How can I find the expected number of tosses , required to obtain a {HT,TH,TT} , by using random variables?? On Friday, December 31, 2010 8:27:46 PM UTC+5:30, Dave wrote: @Anuj and Bittu: It is not necessary to know the bias. You can simulate the flip of an unbiased coin with multiple flips

[algogeeks] Re: directi paper pattern

2012-08-02 Thread piyush dureja
plz mail it to me too... piyushdur...@gmail.com On Tuesday, July 31, 2012 7:37:03 PM UTC+5:30, deepikaanand wrote: can anyone tell me the pattern (selection procedure )followed by directi this year -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] directi paper pattern

2012-07-31 Thread Piyush Khandelwal
@ md shaukat ali: Hi ! Directi is visting our campus in this week. Can u plz forward the paper that u mentioned to me. Thanx in advance. *Piyush Khandelwal** | Placement Coordinator**, Delhi Technological University ( Delhi College of Engineering )* Mobile: 91-8447229204 www.dce.edu Get

Re: [algogeeks] Microsoft online questions

2012-07-29 Thread Piyush Khandelwal
@ Purani : Hi ! Can u tell me, when was this test conducted. *Piyush Khandelwal** | Placement Coordinator**, Delhi Technological University ( Delhi College of Engineering )* Mobile: 91-8447229204 www.dce.edu Get a signature like this. http://r1.wisestamp.com/r/landing?promo=17dest=http%3A%2F

Re: [algogeeks] Programming Problem

2012-07-20 Thread piyush khanna
@ashish jain :then what for aaab.. From: ashish jain ashishjainco...@gmail.com To: algogeeks@googlegroups.com Sent: Thursday, July 19, 2012 9:48 PM Subject: Re: [algogeeks] Programming Problem if from the string s.. a binary search tree (with higher value

Re: [algogeeks] Need Help with PHP/HTML

2012-07-16 Thread Piyush
connect ur form with the file you want to get redirected to by: form method=POST action=NAME_OF_FILE.php input type=submit/ /form -- 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] expectation values..

2012-06-17 Thread Piyush Kapoor
+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Regards,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group

Re: [algogeeks] Microsoft Interview Question

2012-06-13 Thread Piyush Kapoor
, 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. -- *Regards,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- You received

Re: [algogeeks] Re: problem

2012-06-10 Thread Piyush Kapoor
A correction, it is *(2^p) - 1 *, and the answer (*2^(number of primes less than n)) - 1* .(It is simply taking any subset of the primes,leaving the one in which do not take any prime) On Sun, Jun 10, 2012 at 10:03 PM, Piyush Kapoor pkjee2...@gmail.com wrote: The problem simply asks you

Re: [algogeeks] amazon

2012-05-30 Thread Piyush Khandelwal
to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Khandelwal*** Mobile No: 91-8447229204 91-9808479765 -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] Re: Microsoft interview question

2012-05-21 Thread Piyush Grover
@Partha try with: A = {2, 2, 9} B= {1, 6, 6} On Mon, May 21, 2012 at 7:08 PM, partha sarathi Mohanty partha.mohanty2...@gmail.com wrote: a[] = [-1,-3,4,0,7,0,36,2,-3] b[] = [0,0,6,2,-1,9,28,1,6] b1[] = [0,7,0,36,4,-6,3,0,0] b2[] =[-1,-3,11,0,0,0,35,0,0] suma = 42 proda = -84*72*3

Re: [algogeeks] Re: Microsoft interview question

2012-05-20 Thread Piyush Khandelwal
this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Khandelwal*** Mobile No: 91-8447229204 91-9808479765 -- You received this message because you are subscribed

Re: [algogeeks] Re: Find Power(N,N),

2012-05-17 Thread Piyush Khandelwal
. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Khandelwal** *Contact: 91-8447229204 -- 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] Re: validate bit pattern : MS question

2012-05-17 Thread Piyush Khandelwal
=en. -- *Piyush Khandelwal*** Mobile No: 91-8447229204 91-9808479765 -- 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: finding anagrams in a list of words

2012-05-15 Thread Piyush Khandelwal
. 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. -- *Piyush Khandelwal** *Mobile No: 91-8447229204 -- You received this message because you are subscribed

Re: [algogeeks] Array problem

2012-03-12 Thread Piyush Kapoor
: @piyush : i dont think so BIT would work over here , we are not just reporting cumulative sum tilll index i. On Mon, Mar 12, 2012 at 12:58 AM, Piyush Kapoor pkjee2...@gmail.comwrote: This can be done very easily with the help of a Binary Indexed Tree,and it is very short to code as well.Simply

Re: [algogeeks] Array problem

2012-03-12 Thread Piyush Kapoor
1)First map the array numbers into the position in which they would be, if they are sorted,for example {30,50,10,60,77,88} --- {2,3,1,4,5,6} 2)Now for each number ,find the cumulative frequency of index ( = the corresponding number in the map - 1). 3)Output the cumulative frequency and increase

Re: [algogeeks] ORDERS

2012-02-06 Thread Piyush Kapoor
. -- *Regards,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- 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] someone pls explain the o/p??

2012-01-29 Thread Piyush Kapoor
xy is a mixed expression involving two operands of different types,one of unsigned int and other signed int.Since implicit type conversion takes place in such cases,the signed int is converted to unsigned int ,which means that -2(signed) is converted to 4294967294 (unsigned) .,and then the

[algogeeks] Re: IIIT Hyderabad presents Gordion knot

2012-01-24 Thread Piyush/Parrik Ahuja
Hi Coders , The felicity team , IIIT -Hyderabad presents the Gordian Knot . *Global Test run is going on and will end by today(i.e. 24th january) midnight (Indian Stand. Time) . *Main Event: Starts at 10:00 AM (Indian Stand. Time) 25th January and Ends at 5:00 PM(Indian Stand. Time) 26th

Re: [algogeeks] Re : GAMECOIN

2012-01-23 Thread Piyush Kapoor
) == (N-1)C2 4)Using exactly 3 'H's::== (N-2)C3 and so on.. Answer = = 1+NC1 + (N-1)C2 + (N-2)C3 + . (till N-r =r) which is same as fibonacci series. So the answer was the fibonacci number divided by (2^n) -- *Regards,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- You received this message because

Re: [algogeeks] kth largest element in an unsorted list

2012-01-14 Thread Piyush Grover
you can do it in nlogk or n+klogn time. create a min-heap tree of size k with first k nodes. Add k+1..n nodes in the tree. Everytime you insert a node in the tree check if it's greater than the root node. If yes remove root node and insert the new node (logk operations). So time complexity will

[algogeeks] Facebook interview question.

2012-01-08 Thread Piyush Grover
Given a set S, find all the maximal subsets whose sum = k. For example, if S = {1, 2, 3, 4, 5} and k = 7 Output is: {1, 2, 3} {1, 2, 4} {1, 5} {2, 5} {3, 4} Hint: - Output doesn't contain any set which is a subset of other. - If X = {1, 2, 3} is one of the solution then all the subsets of X {1}

Re: [algogeeks] Facebook interview question.

2012-01-08 Thread Piyush Grover
: @Piyush : you are re-posting same problem which you had posted on 5 dec 2011. check this link :- http://groups.google.com/group/algogeeks/browse_thread/thread/8a58ea05c96f811b/ee74f8a4d7b68561?lnk=gstq=Maximal+possible+subsets+Algorithm#ee74f8a4d7b68561 On Mon, Jan 9, 2012 at 3:27 AM, Piyush

Re: [algogeeks] Re: Facebook Question

2011-12-25 Thread Piyush Kansal
. 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. -- Regards, Piyush Kansal -- You received

Re: [algogeeks] Re: which is the right data structure to use for a given problem ?

2011-12-25 Thread Piyush Kansal
. 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. -- Regards, Piyush Kansal -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Re: Frequency Sort Algo

2011-12-25 Thread Piyush Kansal
://groups.google.com/group/algogeeks?hl=en. -- Regards, Piyush Kansal -- 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

[algogeeks] Re: How to solve this

2011-12-23 Thread Piyush Kansal
Hey Ankur, What is the order of time complexity we are looking for in this case. The option which Dave suggested can give us random node by traversing that many number of nodes from the head. That will be O(n). This can be further reduced to n/2 if we use two pointers, both of which will

Re: [algogeeks] A bst problem

2011-12-10 Thread Piyush Grover
insertNode(node *head, int value){ node *new; if(head == null){ new = (node*)malloc(sizeof(node)); new-data = value; new-left = new-right = new-inoredrsucc = null; head = new; }else{ node *root = head; node *l, *r;

Re: [algogeeks] A bst problem

2011-12-10 Thread Piyush Grover
- right 22-left = 22-right = null; 22-succ = 18-succ = null; 18-right = 18-succ = 22; and so on... On Sat, Dec 10, 2011 at 6:49 PM, AMAN AGARWAL mnnit.a...@gmail.com wrote: Hi Piyush, I tried with the following data 15,13,18,22,21. I think your code is not giving proper inorder succ of node 18

Re: [algogeeks] A bst problem

2011-12-10 Thread Piyush Grover
not taken that into consideration. Please correct me if I am wrong. Regards, Aman, On Sat, Dec 10, 2011 at 7:37 PM, Piyush Grover piyush4u.iit...@gmail.comwrote: I don't think so. First you added 15. 15-left = null=15-right=15-succ; add 13. (13 15) so 13-left = 13-right = null; 13-succ

Re: [algogeeks] A bst problem

2011-12-10 Thread Piyush Grover
-Piyush On Sat, Dec 10, 2011 at 8:28 PM, AMAN AGARWAL mnnit.a...@gmail.com wrote: Hi. So can you please tell me the modifications required so it works correctly. Regards, Aman. On Sat, Dec 10, 2011 at 8:22 PM, Piyush Grover piyush4u.iit...@gmail.comwrote: yup, you are right.. On Sat, Dec

Re: [algogeeks] Maximal possible subsets Algorithm

2011-12-05 Thread Piyush Grover
: The possibility is ruled out by your question itself.There are exponential subsets of a set,so finding all subset is not possible in polynomail time. A backtracking approach is what you should think on, On Mon, Dec 5, 2011 at 12:51 PM, Piyush Grover piyush4u.iit...@gmail.comwrote: Given a set S

Re: [algogeeks] Re: Maximal possible subsets Algorithm

2011-12-05 Thread Piyush Grover
Solution: {1, 2, 3} {1, 2, 4} {1, 2, 5} {1, 3, 4} {3, 5} On Mon, Dec 5, 2011 at 2:38 PM, sourabh sourabhd2...@gmail.com wrote: @ Piyush.. I have a doubt... Is there any significance of the value Vi, if yes then can u give an example. If not, then is your question about finding all maximum

Re: [algogeeks] Re: Maximal possible subsets Algorithm

2011-12-05 Thread Piyush Grover
As I mentioned earlier solution with exponential time-complexity is the obvious one. Is there any way to solve this problem by greedy/Dynamic algo? On Mon, Dec 5, 2011 at 5:24 PM, WgpShashank shashank7andr...@gmail.comwrote: @piyuesh , Saurabh isn't 3-Sum Suffics Here ? Another thought

[algogeeks] Maximal possible subsets Algorithm

2011-12-04 Thread Piyush Grover
(polynomial if exists). Thanks Piyush -- 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] Google Question--Suggest Algo

2011-11-27 Thread Piyush Grover
Optimal split: [0,0][1,1][0,0][1,1][0,1][1,0] Expected value of optimal split: 0 + 1 + 0 + 1 + 1/2 + 1/2 = 3 why this is not the optimal split??? On Sun, Nov 27, 2011 at 6:58 PM, Ankur Garg ankurga...@gmail.com wrote: You have an array with *n* elements. The elements are either 0 or 1. You

Re: [algogeeks] LCA of a Binary tree not a binary search tree

2011-11-22 Thread Piyush Grover
, Nov 22, 2011 at 1:59 PM, anshu mishra anshumishra6...@gmail.comwrote: first try to understand the sol then comment. it is for binary tree not for BST. On Mon, Nov 21, 2011 at 10:25 PM, Piyush Grover piyush4u.iit...@gmail.com wrote: For BST it would be rather simpler. find the first node

Re: [algogeeks] LCA of a Binary tree not a binary search tree

2011-11-21 Thread Piyush Grover
For BST it would be rather simpler. find the first node which lies in between the two. On Wed, Nov 16, 2011 at 1:44 PM, anshu mishra anshumishra6...@gmail.comwrote: Node *LCA(node *root, node *e1, node *e2, int x) { Node *temp =NULL; Int y = 0;

Re: [algogeeks] Linked List Problem-Suggest Algo

2011-11-21 Thread Piyush Grover
As you mentioned, the numbers designating the gaps can only be repeated so in your example 2 20 can be broken into 19 1 but 19 is already there in the list (the first couplet) and it's not the one which describes the gap. can you please clarify? On Mon, Nov 21, 2011 at 5:23 AM, Ankur Garg

Re: [algogeeks] DS Q

2011-11-17 Thread Piyush
b) Binary search Binary search has to be done in O(logn) but in a linked list individual elements can't be accessed in O(1) time. and hence its not suitable to have a linked list as a data structure in binary search. -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Algm

2011-11-14 Thread Piyush
Has to be (d) Radix sort (using counting sort, which will sort the individual digits in O(n) time). -- 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

Re: [algogeeks] Finding the indexes of a repeated element??

2011-11-08 Thread PIYUSH MADAN
Suppose the array is not sorted and we have to find if an element has occurred earlier or not; and if yes, then remove it.what is the best achievable time and how? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

Re: [algogeeks] choosing numbers

2011-10-23 Thread Piyush Kapoor
. -- *Regards,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- 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] Re: rise and fall of power

2011-10-05 Thread Piyush Kapoor
In which library do powl() and log10l() lie(they r not in cmath,i think) ,can anybody post a good reference to these..(I could not find much on googling) -- *Regards,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] Re: rise and fall of power

2011-10-05 Thread Piyush Kapoor
Yes these are in cmath(or math.h) , /* 7.12.6.8 Double in C89 */ extern float __cdecl log10f (float); extern long double __cdecl log10l (long double); -- *Regards,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- *Regards,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- You received

Re: [algogeeks] Amazon - array problem

2011-09-29 Thread Piyush Grover
Given array A. Compute array B such that B[0] = 1; for(i = 1; i n; i++) B[i] = B[i-1]*A[i-1] now, mul = 1; for (i = n-2; i =0; i--){ mul = mul*A[i]; B[i] = B[i]*mul; } On Fri, Sep 30, 2011 at 2:18 AM, Hatta tmd...@gmail.com wrote: are the algorithm instance always a sequence

Re: [algogeeks] Amazon - array problem

2011-09-29 Thread Piyush Grover
sorry, one mistake... mul = mul*A[i]; it should be mul = mul*A[i+1] On Fri, Sep 30, 2011 at 2:57 AM, Piyush Grover piyush4u.iit...@gmail.comwrote: Given array A. Compute array B such that B[0] = 1; for(i = 1; i n; i++) B[i] = B[i-1]*A[i-1] now, mul = 1; for (i = n-2; i =0; i

Re: [algogeeks] Re: question

2011-09-22 Thread Piyush Kapoor
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. -- *Regards,* *Piyush Kapoor

Re: [algogeeks] Re: random function

2011-09-19 Thread Piyush Grover
as such there is no specific method to generate random number but if you have to implement it then you can generate a pseudo random generator using cur_time_value_in_mili_seconds mod n. On Mon, Sep 19, 2011 at 9:24 PM, Don dondod...@gmail.com wrote: The most common way that it works would be

Re: [algogeeks] Data Structures

2011-09-19 Thread piyush agarwal
. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Piyush Agarwal Final Year Undergraduate Department of Computer Engineering Malaviya National Institute of Technology Jaipur -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: Microsoft Question

2011-09-18 Thread Piyush Grover
for(i = 0; i n; i++) for(j = 0; j n; j++){ setColor(i, j) = black; if(A[i][j] == str[0]){ setColor(i, j) = blue; a = findWord(A, i, j, str, 1) if(!a) setColor(i, j) = black; else break; } } findWord(A, i, j, str, k){ if(k

Re: [algogeeks] Re: Microsoft Question

2011-09-18 Thread Piyush Grover
sry, in the findWord function all a's are different e.g a0, a1a7 and if(!a) is actually if(a0||a1||...||a7) thnx piyush On Mon, Sep 19, 2011 at 1:10 AM, Piyush Grover piyush4u.iit...@gmail.comwrote: for(i = 0; i n; i++) for(j = 0; j n; j++){ setColor(i, j) = black

Re: [algogeeks] Array ques based on correlation factor

2011-09-17 Thread Piyush Grover
a number z is: (n-1)/n *(n-2)/(n-1) * 1/(n-2) = 1/n and so on. So selection of any number at any position is independent of any number being selected. So they have independent and uniform probability. -Piyush On Sat, Sep 17, 2011 at 10:42 PM, sivaviknesh s sivavikne...@gmail.comwrote: Write

Re: [algogeeks] Re: Math Puzzle

2011-09-15 Thread Piyush Grover
Don is right if R = 0, P = 1 and Q = -1 then the given expression is UNDEFINED!!! On Thu, Sep 15, 2011 at 10:16 PM, abhinav gupta guptaabhinav...@gmail.comwrote: Shut up...its 3,, On Thu, Sep 15, 2011 at 9:43 AM, Don dondod...@gmail.com wrote: It might be 3, but it doesn't have to

Re: [algogeeks] Re: Math Puzzle

2011-09-15 Thread Piyush Grover
to 3. Don On Sep 15, 11:57 am, abhinav gupta guptaabhinav...@gmail.com wrote: u cnt divide a number by 0..that thing is self undrstod On Thu, Sep 15, 2011 at 9:49 AM, Piyush Grover piyush4u.iit...@gmail.comwrote: Don is right if R = 0, P = 1 and Q = -1 then the given

Re: [algogeeks] ms question

2011-09-12 Thread Piyush Grover
it should be: (1/n)^n * (1 + 2 + 2^2 + 2^3 +(n/2)+1 terms) = {2^(1 + n/2) - 1}*(1/n)^n when n even (1/n)^n * (1 + 2 + 2^2 + 2^3 +(n-1/2)+1 terms) = {2^(1 + (n-1)/2) - 1}*(1/n)^n when n is odd -Piyush On Mon, Sep 12, 2011 at 8:01 PM, sandeep nagamalli nsandee...@gmail.comwrote

Re: [algogeeks] ms question

2011-09-12 Thread Piyush Grover
Sry i was little wrong: nC0*(1/n)^n + nC2 *2*(1/n)^n + nC4*2^2*(1/n)^n++nCn*2^(n/2)*(1/n)^n when n is even nC0*(1/n)^n + nC2 *2*(1/n)^n + nC4*2^2*(1/n)^n++nCn-1*2^(n-1/2)*(1/n)^n when n is odd On Mon, Sep 12, 2011 at 10:08 PM, Piyush Grover piyush4u.iit...@gmail.comwrote: it should

Re: [algogeeks] Re: worst case complexity

2011-09-10 Thread Piyush Grover
O(n^4) Just think... for(i = 0; i n; i++) for(j = 0; j i; j++) has Time Complexity O(n^2) then how come for(i = 0; i n; i++) for(j=0; ji*i; j++) it's O(n^2).. it's...1 + 2^2 + 3^2 + ...n^2 which is O(n^3) but adding one for(k=0; k j; k++) will not make

Re: [algogeeks] What would be the ans.

2011-09-10 Thread Piyush Grover
I got.. 1.) 2/pi 2.) 3.) 0.5 - (1/pi) On Sat, Sep 10, 2011 at 2:47 PM, Ishan Aggarwal ishan.aggarwal.1...@gmail.com wrote: three points are randomly chosen on a circle.what the probability that 1.triangle formed is right angled triangle. 2.triangle formed is acute angled triangle.

Re: [algogeeks] What would be the ans.

2011-09-10 Thread Piyush Grover
Sorry guys.. I was wrong, radius also matters here... still investigating On Sat, Sep 10, 2011 at 3:56 PM, sarath prasath prasathsar...@gmail.comwrote: @Piyush Grover: please explain ur answer On Sat, Sep 10, 2011 at 3:30 PM, Piyush Grover piyush4u.iit...@gmail.comwrote: I got

Re: [algogeeks] What would be the ans.

2011-09-10 Thread Piyush Grover
be 1/3 for each of the three options... On Sat, Sep 10, 2011 at 4:48 PM, Piyush Grover piyush4u.iit...@gmail.comwrote: Sorry guys.. I was wrong, radius also matters here... still investigating On Sat, Sep 10, 2011 at 3:56 PM, sarath prasath prasathsar...@gmail.comwrote: @Piyush

Re: [algogeeks] What would be the ans.

2011-09-10 Thread Piyush Grover
it would be close to zero but not exactly zero. On Sat, Sep 10, 2011 at 6:28 PM, Ishan Aggarwal ishan.aggarwal.1...@gmail.com wrote: How u calculated this?? On Sat, Sep 10, 2011 at 6:19 PM, Neha Singh neha.ndelhi.1...@gmail.comwrote: The correct ans is : for right angled triangle : 0

Re: [algogeeks]

2011-09-09 Thread Piyush Grover
pseudo algo: =array idx[0...k-1] indicates the current pointer position in the ith stream(initialized to 0). =heap tree of size k where each node stores value of the data and value of stream which the node belongs to. do{ for all i = 0:k-1 =insert idx[i] value of ith stream to the

Re: [algogeeks] Kth largest element

2011-09-08 Thread Piyush Kapoor
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. -- *Regards,* *Piyush Kapoor,* *2nd year,CSE

Re: [algogeeks] sorting

2011-09-08 Thread Piyush Grover
It depends on the use cases. If you have less elements of order of( say 100) then even insertion sort can be a better choice. It's in-place sorting algo and can perform sorting as it receives the elements like a stream. If you have large number of elements and all the elements can't be

Re: [algogeeks] ACM

2011-09-08 Thread Piyush Kapoor
to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Regards,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] Objective Question

2011-09-07 Thread Piyush Grover
Option a) i didn't understand properly, please elaborate!! Option b) certainly yes. Option c) No (remember, the size of the table is subjective) Option d) yes (use index on the column used in the where clause) On Wed, Sep 7, 2011 at 8:58 PM, Mani Bharathi manibharat...@gmail.comwrote: when

Re: [algogeeks] Re: Element in Array Repeated Even Number of Times

2011-09-07 Thread Piyush Grover
i don't think it's of O(n) for even it's actually easy. Take the xor of all the elements you will left with the element which appears odd number of times. O(n) but for the odd case, we need to use extra space. Use hash map to keep the count of each number and take the odd one out, i mean the even

Re: [algogeeks] answer these interesting questions

2011-09-07 Thread Piyush Grover
1.)a 2.)b 3.)b 4)b On Wed, Sep 7, 2011 at 11:08 PM, Mani Bharathi manibharat...@gmail.comwrote: “Kya-Kya” is an island inhabitants of which always answer any question with two answers , one of which is true and the other is false . 1.You are walking on a road and came to a park . You ask

Re: [algogeeks] answer these interesting questions

2011-09-07 Thread Piyush Grover
4) a and b On Thu, Sep 8, 2011 at 12:08 AM, Piyush Grover piyush4u.iit...@gmail.comwrote: 1.)a 2.)b 3.)b 4)b On Wed, Sep 7, 2011 at 11:08 PM, Mani Bharathi manibharat...@gmail.comwrote: “Kya-Kya” is an island inhabitants of which always answer any question with two answers , one

Re: [algogeeks] virtual memory

2011-09-06 Thread Piyush Grover
it's a subjective question. If you have 100GB of main memory and 2 GB of virtual memory and you are running very light weight programs then nothing will happen. The system memory has enough space to take care of all the applications but if your system is heavily loaded with processes then it

[algogeeks] plz xplain the o/p

2011-09-06 Thread piyush agarwal
#includestdio.hvoid swap(char *, char *); int main() { char *pstr[2] = {Hello, piyush}; swap(pstr[0], pstr[1]); printf(%s\n%s, pstr[0], pstr[1]); return 0; }void swap(char *t1, char *t2) { char *t; t=t1; t1=t2; t2=t; } -- Piyush Agarwal Final Year Undergraduate

Re: [algogeeks] MS question

2011-09-05 Thread Piyush Grover
One thing i would like to know is 01/02/2011 needs to be considered or 1/02/2011. thnx On Mon, Sep 5, 2011 at 11:48 PM, Neha Singh neha.ndelhi.1...@gmail.comwrote: @yogesh: its stiil not correct. There r many test cases where ur solution will fail -- You received this message because you

Re: [algogeeks] Re: probability question

2011-09-05 Thread piyush agarwal
://groups.google.com/group/algogeeks?hl=en. -- Piyush Agarwal Final Year Undergraduate Department of Computer Engineering Malaviya National Institute of Technology Jaipur -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

Re: [algogeeks] character count in array

2011-09-03 Thread Piyush Grover
use hashing u'll get O(1) space.. @rahul...why not?? On Sat, Sep 3, 2011 at 7:13 PM, priya ramesh love.for.programm...@gmail.com wrote: use hashing -- 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: memory allocation question

2011-09-03 Thread piyush agarwal
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. -- Piyush Agarwal Final Year Undergraduate Department of Computer Engineering Malaviya

Re: [algogeeks] Re: Find Max Sum Value Pairs

2011-09-03 Thread Piyush Grover
@Dave..:-O well catch... On Sat, Sep 3, 2011 at 9:00 PM, Dave dave_and_da...@juno.com wrote: @Piyush: Try your code with n = 10 a[10] = {11,22,33,44,55,66,77,88,99,110} b[10] = {10,20,30,40,50,60,70,80,90,100} Your code gets (110, 100) = 210 (110, 90) = 200 (99, 100) = 199 (110, 80

Re: [algogeeks] Need algorithm asap

2011-09-02 Thread Piyush Kapoor
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. -- *Regards,* *Piyush Kapoor,* *2nd year,CSE IT-BHU* -- You received

Re: [algogeeks] Re: Find Max Sum Value Pairs

2011-09-02 Thread Piyush Grover
if I have understood the question correctly then: a[n-1] + b[i] a[j] + b[i] for all 0 = j n-1 and a[j] + b[n-1] a[j] + b[i] for all 0 = i n-1 therefore, i = j =n-1; count = 1; S[0] -- (a[n-1], b[n-1]) p = a[n-1] + b[n-2]; q = a[n-2] + b[n-1] while(count n){ if(p q){ j--;

  1   2   3   4   >