[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] wrote: Feng, how can form a triangle

[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

[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 iostream.h void main() { int a[10][4]= {{ 16,17,19,13},

[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: 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: 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

[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: 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: 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

[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: 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

[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

[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

[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: 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

[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]

[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

[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

[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

[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 email

[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

[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

[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 ??