[algogeeks] point lying inside or not

2010-07-01 Thread sharad kumar
a polygon is given(convex or concave) given a point u have to find whether it is lying inside polygon or not -- 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

Re: [algogeeks] computational geometry

2010-07-01 Thread sharad kumar
@Amir i m not able to understand how complexity is o(n) if u r doing for all vertices...plzz elaborate -- 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

[algogeeks] Re: non recursive tree traversals

2010-07-01 Thread vicky
I m adding my program too, with some 2-3 added features: #include stdio.h #include stdlib.h #include string.h #includeconio.h #includeiostream #include stack #include algorithm #include queue using namespace std; // BST-node layout typedef struct Tree{ int data; Tree *left; Tree

Re: [algogeeks] addition using bitwise

2010-07-01 Thread anand verma
@Priyanka.can u plz explain what is wrong in SHRINIVAS' code?? -- 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 group, send email to

[algogeeks] A nice Prob

2010-07-01 Thread vicky
It took me more time to understand this problem then solving after i understood. You guys too have a look @ it.:: Let f(k) = y where k is the y-th number in the increasing sequence of non-negative integers with the same number of ones in its binary representation as y, e.g. f(0) =

[algogeeks] Some C language Problem

2010-07-01 Thread Ashish
Q.) How to create our own Header file ? and Q) Can we insert a our function in the existing header file ?? -- 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

[algogeeks] Re: sort 0's 1's and 2's

2010-07-01 Thread Gene
On Jun 30, 3:38 am, Debajyoti Sarma sarma.debajy...@gmail.com wrote: @Gene your code's last 3 line gives doubt.  ...  for (i = j = 0; j M; j++)    while (c[j]--)      a[i++] = j; ... Is it don't make the complexity more than O(n) ?? Not at all. The inner loop body executes n

Re: [algogeeks] point lying inside or not

2010-07-01 Thread jalaj jaiswal
shoot a ray towards positive x axis starting from that point.. if it intersect the polygon odd number of times it is inside else outside On Thu, Jul 1, 2010 at 12:50 PM, sharad kumar aryansmit3...@gmail.comwrote: @sharad:make use of convex hull algorithm.i feel that should do the trick.

Re: [algogeeks] Re: point lying inside or not

2010-07-01 Thread sharad kumar
@dave thnx now i understood the soln @sharad can u tell me how it can be done using convex hull algo -- 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: isbst

2010-07-01 Thread divya jain
@ above here u r comparing node value with min and max only for eg if ur tree is 45 / \ 65 85 / 25 ur code will say that this is bst.

Re: [algogeeks] addition using bitwise

2010-07-01 Thread Priyanka Chatterjee
nothing is wrong.i wrote sorry in my third mail On 1 July 2010 14:04, anand verma anandandymn...@gmail.com wrote: @Priyanka.can u plz explain what is wrong in SHRINIVAS' code?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Some C language Problem

2010-07-01 Thread jaladhi dave
For header file creation see any standard c library header files example. One thing to take care is to create a C define which will cause the file to be included only once. Regarding inserting the function, its prototype should be defined in appropriate header file and the code in associated .c

Re: [algogeeks] Some C language Problem

2010-07-01 Thread mohit ranjan
@Ashish 1. Good article telling u how to create ur own header, and corresponding library http://www.ibm.com/developerworks/library/l-shobj/ 2. *I don't thnk it's possible*, as all implementation of API exposed thru header are presnt in some library, where we can't do any change... i may b wrong

Re: [algogeeks] Re: sort 0's 1's and 2's

2010-07-01 Thread jalaj jaiswal
in this case counting sort is inplace as how long the input array be ..the auxilary array will be of soze 3 only.. and counting sort is stable too On Thu, Jul 1, 2010 at 7:43 AM, Gene gene.ress...@gmail.com wrote: On Jun 30, 12:21 am, Sathaiah Dontula don.sat...@gmail.com wroe: @Gene, Your

[algogeeks] BST with duplicates?

2010-07-01 Thread amit
Can a BST have duplicate entries ?? .8 .../...\ .7..9 /..\/..\ ...6...8..8...10 i.e is this a BST . -- 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.

Re: [algogeeks] OS problems

2010-07-01 Thread Anand
if there are 32 such frames of 8 X 1024 then the logical address will be (10+5)15 as pointed out by Harit. On Thu, Jul 1, 2010 at 8:57 AM, sharad kumar sharad20073...@gmail.comwrote: i think harit's answer is correct regarding ques 2 plzz someone comment on this -- You received this message

Re: [algogeeks] Re: sort 0's 1's and 2's

2010-07-01 Thread Anand
On Thu, Jul 1, 2010 at 5:33 AM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote: in this case counting sort is inplace as how long the input array be ..the auxilary array will be of soze 3 only.. and counting sort is stable too On Thu, Jul 1, 2010 at 7:43 AM, Gene gene.ress...@gmail.com wrote:

Re: [algogeeks] point lying inside or not

2010-07-01 Thread sharad kumar
@jalaj ur method fail when it is lying on the corner plzz consider case for that also -- 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 group, send email

[algogeeks] array

2010-07-01 Thread sharad
1.an array of 2n+1 elements is given .one element is repeated n times and rest all are different.find the no repeated. 2.same question as above but this time other no's are not different ..i.e they can repeat. -- You received this message because you are subscribed to the Google Groups

[algogeeks] recurring number

2010-07-01 Thread jalaj jaiswal
we are given with Numerator and Denominator. After division we might get a recurring decimal points float as the answer. For example 23.34563456 ... return 3456 i.e the recurring part i did it by converting the decimal part into string(itoa).. then a scan to find the first repeated character

Re: [algogeeks] BST with duplicates?

2010-07-01 Thread sharad kumar
no a bst cant hve duplicates -- 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 group, send email to algogeeks+unsubscr...@googlegroups.com. For more

Re: [algogeeks] Re: sort 0's 1's and 2's

2010-07-01 Thread Dheeraj Jain
http://geeksforgeeks.org/?p=8133 has the complete solution On Thu, Jul 1, 2010 at 5:33 AM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote: in this case counting sort is inplace as how long the input array be ..the auxilary array will be of soze 3 only.. and counting sort is stable too On Thu,

Re: [algogeeks] BST with duplicates?

2010-07-01 Thread mohit ranjan
@Amit as per wiki, BST definition is - The left subtree of a node contains only nodes with keys *less than the node's key*. - The right subtree of a node contains only nodes with *keys greater than or equal to the node's key*. so, this following example is not a BST... Mohit On

Re: [algogeeks] Project on finding an optimal route given a map.

2010-07-01 Thread siddharth srivastava
Hi On 28 June 2010 23:01, Abhishek Sharma jkabhishe...@gmail.com wrote: @senthil: thanks for the interest.. I did that purposely..(just wanted to see if any1 is interested or not).. here are the details... I have a map..of a small area (say a college campus).. in OSM(openstreetmap) format

[algogeeks] Finding Duplicates in Random Array

2010-07-01 Thread Vikas Jayaprakash
Hi AlgoGeeks, Can anyone provide me answers for the below. 1. given an array of random integers write a program to (1) detect duplicate (2) remove duplicate (array should not get hampered at any cost!). 2 - In a sorted array some of the elements say N are rotated. for example initially 1 2 3 6

Re: [algogeeks] Re: isbst

2010-07-01 Thread Dheeraj Jain
http://geeksforgeeks.org/?p=3042 has all the approaches (right and wrong) for solving this. On Thu, Jul 1, 2010 at 4:43 AM, divya jain sweetdivya@gmail.com wrote: @ above here u r comparing node value with min and max only for eg if ur tree is 45

Re: [algogeeks] Re: sort 0's 1's and 2's

2010-07-01 Thread jalaj jaiswal
i was talking about the space complexity.. running time is obvs O(n) On Thu, Jul 1, 2010 at 9:14 PM, Gene gene.ress...@gmail.com wrote: On Jun 30, 3:38 am, Debajyoti Sarma sarma.debajy...@gmail.com wrote: @Gene your code's last 3 line gives doubt. ... for (i = j = 0; j M; j++)

[algogeeks] Re: sort 0's 1's and 2's

2010-07-01 Thread Gene
On Jul 1, 4:04 pm, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote: i was talking about the space complexity.. running time is obvs O(n) Hello J.J. Why would those 3 lines of executable code you cited say anything about space complexity? They don't allocate memory. You must be quibbling.

[algogeeks] Re: recurring number

2010-07-01 Thread Dave
Does it work for 1/17, 2/17, 3/17, etc.? Dave On Jul 1, 5:23 pm, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote: we are given with  Numerator and Denominator. After division we might get a recurring decimal points float as the answer. For example 23.34563456 ... return 3456 i.e the recurring