[algogeeks] Re: Testing if 3 points form a triangle

2007-06-09 Thread BiGYaN
On Jun 5, 1:45 am, Feng <[EMAIL PROTECTED]> wrote: > Hi BiGYaN, triangle is a 2D object which can be formed by any 3 non- > collinear points. It can exist in 4D, just like a point existing in > 3D. > > On May 31, 2:11 am, "Victor Carvalho" <[EMAIL PROTECTED]&g

[algogeeks] Re: help me with finding the time complexcity

2007-05-29 Thread BiGYaN
On May 28, 6:21 pm, sl7fat <[EMAIL PROTECTED]> wrote: > hi i have an algorthim code and i have to find the time complixcity of > the code so can you plz help me ASAP the code is written done ,, > # include > > void main() > { > > int a[10][4]= > {{ 16,17,19,13}, > {18,14,1

[algogeeks] Re: Testing if 3 points form a triangle

2007-05-29 Thread BiGYaN
Just test whether they are collinear or not i.e. get the slopes, m1 from 1st and 2nd point m2 from 2nd and 3rd point if m1==m2 then they do not form a triangle else they do Computing the area of the triangle and testing for 0 might also work but I feel that the computation will be big

[algogeeks] Re: interesting collinear Points problem

2007-05-15 Thread BiGYaN
As far as I get it, this may be the solution : Find out all the possible lines between those n points (total of nC2 lines). Here we define a line to be an ordered set of 2 points where the first point is < 2nd point (ie. length of origin to first point is < length of origin from 2nd point). Then

[algogeeks] Re: Farmer John find location barn

2007-05-07 Thread BiGYaN
You just want a solution or you want a DPP solution? A O(n^4) solution is trivial in nature and is quite easily achievable. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this g

[algogeeks] Re: Given Infinite array ,Find one number problem

2007-05-07 Thread BiGYaN
@ Arun By, "arr[i].val" I meant the value stored in i-th position and not the valid/invalid bit. So I'm not making any assumption related to storing of valid numbers in contiguous positions. Guess I should have written "arr[i].value" as "val" is common to both "value" as well as "valid". --~--

[algogeeks] Re: Given Infinite array ,Find one number problem

2007-05-07 Thread BiGYaN
@ Arun By, "arr[i].val" I meant the value stored in i-th position and not the valid/invalid bit. So I'm not making any assumption related to storing of valid numbers in contiguous positions. Guess I should have written "arr[i].value" as "val" is common to both "value" as well as "valid". --~--

[algogeeks] Re: Given Infinite array ,Find one number problem

2007-05-06 Thread BiGYaN
Infinite Array ? Infinite Array in sorted order ? Let's say we have an infinite array where each of the elements have a number (according to which it is sorted) and a valid/invalid bit for storing the validity. s - number we are searching for arr[] - the infinite array inc = 100;// this is

[algogeeks] Re: Sets having sum equal to N

2007-04-30 Thread BiGYaN
This is a Subset-Summation problem which is proven to be NP-Complete. So there are no ways that you can devise a clever algo to solve it accurately. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks"

[algogeeks] Re: binary tree

2007-04-30 Thread BiGYaN
The thing that you asked for is formally known as BFT (Breadth First Traversal). Here's the pseudo-code that'll give you the idea in general. #define MAX 100 void BFT ( node *root ) { node *p; ins_Q(root);// inserting the node into a queue do {

[algogeeks] Re: Heaps vs. B-Tree

2007-04-19 Thread BiGYaN
There is no perfect hash function that will give an unique location every time it is called. So BTrees will be faster no doubt. Also note that with BTrees (or B+Trees) it is easier to retrieve data filtered on range(s) of keys. --~--~-~--~~~---~--~~ You received

[algogeeks] Re: Solution for Automata

2007-04-19 Thread BiGYaN
I would also like to visit such a site. Its been quite frustrating trying out problems for hours only to find out that nowhere can you get the correct solution. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algor

[algogeeks] Re: Height of a binary tree

2007-04-19 Thread BiGYaN
Yup dudes I agree it was a wrong program I have put the proper indentation without proper braces and that makes the code incorrect. The correct program would be : int getheight ( node *p ) { if ( p==NULL ) return 0; else { rh = getheight ( p->right );

[algogeeks] Re: Height of a binary tree

2007-04-17 Thread BiGYaN
We will be calling the function like : height = getheight(root); and here's the function defination : int getheight ( node *p ) { if ( p==NULL ) return 0; else rh = getheight ( p->right ); lh = getheight ( p->left ); return ( (lh>rh ? lh : rh)+1 ); } --~-

[algogeeks] Re: Algoritm needed

2007-03-28 Thread BiGYaN
This looks like the classic Assignment problem to me do look up on this topic and I'm sure you'll come across a few good algos. Initially, it seems that it'll be an O(n^3) problem but maybe you can better it !! --~--~-~--~~~---~--~~ You received this me

[algogeeks] Re: RR*=R* ?

2007-03-28 Thread BiGYaN
RR* = R* only when R contains a null string. else, RR* = R+ --~--~-~--~~~---~--~~ 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 fr

[algogeeks] Re: 2D arrays

2007-03-18 Thread BiGYaN
Please don't post homework questions here. This problem is too simple for a group calling themselves "Algorithm Geeks". I hope most of you'll agree to this and put a stop to this practice. --~--~-~--~~~---~--~~ You received this message because you are subscribed

[algogeeks] Re: Sorting o(n) time

2007-03-18 Thread BiGYaN
Yeah, after finding the k-th element there is no need for further partitioning. This is logically true indeed. But in this case, I guess you have to do it for determining who'll get the Samosas and who the Gulabjamuns !!. --~--~-~--~~~---~--~~ You received this m

[algogeeks] Re: Sorting o(n) time

2007-03-17 Thread BiGYaN
Yeah the average case is O(n) and worst case is O(n^2) as rightfully pointed out. But I still feel that this would be the best solution as the P(worst case) is quite less. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gro

[algogeeks] Re: C++

2007-03-17 Thread BiGYaN
You could try : The C++ Programming Language (3rd or Special Ed) by, Bjarne Stroustrup This is the fellow who developed the C++ language and this is really an awesome book. However if you are a newbie to programming then you might find certain difficulties with it. --~--~-~--~~

[algogeeks] Re: Sorting o(n) time

2007-03-15 Thread BiGYaN
You could try the quick-sort algo with these further modifications : every time you partition the list (assuming ascending) you leave out the entire working for the right hand part iff the size of the left hand part is >= m (m is the top m elements that you need). NB : Here left hand part indicate

[algogeeks] Re: Bitwise 2007

2007-02-15 Thread BiGYaN
ThankZ a lot --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] F

[algogeeks] Bitwise 2007

2007-02-13 Thread BiGYaN
Anybody got solutions for the Bitwise 2007 problems? I'm particularly stuck with 2, 3, 4 (2nd part). I have solved 1, 5, 6, 7. Here's the link to my solutions and the complete problem set : http://naygib.blogspot.com/2007/02/bitwise-2007.html Here's the link to the original site of Bitwise 2007

[algogeeks] Re: C/C++ Programming

2006-05-13 Thread BiGYaN
Trying to write an OS at 12 !! GR8. But unfortunately writing an OS is very difficult. I have written only a basic OS like DOS. It took me around a month and I am a Computer Science final year student. So dump the idea of writing an OS atleast for now. Better write some utility programs lik

[algogeeks] Re: Is there any other way to find factorial of number except multiplication

2006-05-03 Thread BiGYaN
To get the factorial exactly, you'd surely have to multiply and find out. But no.s like 321! are too big to be used with all the digits. So you can use one of the many very good approximation methods to find it out. --~--~-~--~~~---~--~~ You received this message

[algogeeks] Re: Finding the k largest/smallest elements in the array !

2006-04-26 Thread BiGYaN
Deepu, are you sure that this Algo will have an O(n) complexity. None of my friends and for that matter most of my teachers disagree with it having a linear time bound. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[algogeeks] Re: Finding the k largest/smallest elements in the array !

2006-04-24 Thread BiGYaN
It is rather easy of you want an n(log n) algo. But linear I don't thaink so. --~--~-~--~~~---~--~~ 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

[algogeeks] Re: Finding the k largest/smallest elements in the array !

2006-04-24 Thread BiGYaN
you are wrong. It is of O(n^2) sine there is a k outer loop and an i inner loop. --~--~-~--~~~---~--~~ 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.c

[algogeeks] Re: Point Inside Polygon - Ray Method

2006-04-20 Thread BiGYaN
That link was gr8. Thanks for pointing it out. --~--~-~--~~~---~--~~ 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,

[algogeeks] Re: Graph Theory

2006-04-20 Thread BiGYaN
Graph Theory by, N. Deo It is a nice book covering almost the entire subject from ground up. And yes, you don't have to be a CS Major to read this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks"

[algogeeks] Re: Request For a classical Paper of Prof. Korf

2006-04-19 Thread BiGYaN
I am also searching it for a while. Please if anybody could post a link --~--~-~--~~~---~--~~ 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 uns

[algogeeks] Re: Assignment: get integers and display in words

2006-04-14 Thread BiGYaN
Why the hell are you posting your damn silly assignment problems in this group. I could solve them in Std IX. If you cannot solve it you ought to be ashamed of yourself. This is not a school assignment forum. --~--~-~--~~~---~--~~ You received this message becau

[algogeeks] Re: check string A and B isPermutation ?

2006-04-11 Thread BiGYaN
Assuming that you cannot have any letter repeated more than 15 times. Create a struct of 26, 4 bit bitfields. This is going to take 26x4 bits or 13 bytes of memory. Use this structure to store the character count of each character of the first string. Now proceed to the second string and for ea

[algogeeks] Re: Subset with largest sum

2006-04-08 Thread BiGYaN
It is simple. Here are the steps, tot = sum of the entire array max = tot start = 0 end = n-1 sub_start = start sub_end = end while ( start < end ) { if ( array[start] < array[end] ) { tot=tot-array[start] start++ } else { tot=tot-array[start] end-- } if ( tot >= max

[algogeeks] Re: Program This!

2006-03-28 Thread BiGYaN
Hey Admin, Please ban this fellow. He's just using the group for his own well being and spamming the group !! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send emai

[algogeeks] Re: Inscription test run problems

2006-03-27 Thread BiGYaN
With regards to the first problem, it is pretty easy if you can have all the primes precomputed. As a matter of fact, if you search the net, you'll find the list of all prime no.s that can be stored as a 4 byte unsigned integer !!. Just use that list of primes to find out the nearest with the help

[algogeeks] Re: What You Must Know About Network Security

2006-03-16 Thread BiGYaN
Stop SPAMMING this group. One look at your profile tells us that you are a SPAMMER with nothing better to do. DO NOT DO THIS AGAIN. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post t

[algogeeks] Re: Balanced tree building

2006-03-14 Thread BiGYaN
If we can have the total no. of nodes in tree as an input (say N), this problem is pretty easy. We construct a full BST of level = ceiling ( log (base 2) N ) - 1 conatining only dummy nodes. Now we travel the BST in the same fashion as a linked list starting from the root node. The root must hav

[algogeeks] Re: A challenging multiplication problem

2006-02-28 Thread BiGYaN
Was that a test-your-knowledge question ? or are u really interested ? If latter then look up Knuth. If u are looking for a solution in a particular domain, this can be solved far easily. Please mention the data structure used for storing the number and the result and upto what accuracy ?? --~-