I experimented with your suggestion 1. Following is the modified
function
public static void cross(List sets) throws Exception {
if (sets.size() == 2) {
FileWriter op1 = new FileWriter(temp.txt);
FileWriter op2 = new FileWriter(out.txt);
for (int i = 0; i
finding all the paths is crazy)) in worst case you get about n! paths.
But even having all the paths, it is not clear how you can find out if
there are k of them sharing no vertex. It is sort of set covering
problem that is not very easy by itself.
@pramod
Arent all the 'n' chords part of the same circle ? If they are how can
they be parallel without intersecting. If they are not of the same
circle then its a different problem.
@Karthik
The complexity is not O(n). It is O(nlg(n)), since my first step is
sorting the chords. Also you are
I am not sure about how this file writing is being done, but I *think* you are writing it record by record, instead of that, u can try writing it block by block of say 1kb. that was your disk accesses are less and you write a bunch of data in a single shot. Not sure, how much will be the
Hi
Does anybody has the follwing ebook
Data Structures and Program Design In C by Robert Kruse, Bruce P.
Leung, Clovis L. Tondo. Published by Prentice Hall
if yes please mail it to [EMAIL PROTECTED]
Thanks and Regards
Ashish Garg
--~--~-~--~~~---~--~~
You
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
Thanks for your comments..
I feel, this portion of code can be optimized as per your suggestion
(I'll try to measure the improvement)
BufferedReader temp = new BufferedReader(new FileReader(out.txt));
FileWriter ot = new FileWriter(temp.txt);
String l = ;
while ((l = temp.readLine()) !=
Venkatesh Dayalan wrote:
Two unknowns x and y are to be found by two mathematicians M1 and M2.
I give the Product(x * y) to M1 and Sum(x + y) to M2.
Suppose that the product is 30.
M1 doesn't know the value of S and M2 doesn't know the value of P.
Now both the mathematicians enter
The answer to the first question is 2. When you take the modulus of a
negative number, think of it as rounding down to a multiple of the
divisor and taking the remainder. If you round down -22 to a multiple
of 3, you get -24, and the difference between -22 and -24 is 2, your
remainder.
I'm not
Dhyanesh wrote:
1 ) Radially sort the all the points of each chord (start and end both ).
2 ) Start with the first start point. Have c=1, tot=0, done[1..n]=0
3 ) Till all points are done:
a ) If its a start point then
tot = tot + c
c = c + 1
set done for this
Dhyanesh wrote:
1 ) Radially sort the all the points of each chord (start and end both ).
2 ) Start with the first start point. Have c=1, tot=0, done[1..n]=0
3 ) Till all points are done:
a ) If its a start point then
tot = tot + c
c = c + 1
set done for this
Lukas alkauskas wrote:
oh thats!, maybe you can give me some examples? or maybe some links with good
information about it.
You asked for the best way, not for code!
-
#include stdio.h
typedef struct node { struct node *next; } *NODE, NODE_REC;
Can we change counting sort to sort inplace only using O(k) space where
the numbers range from 1...k?
The problem precisely is to design a sorting algorithm to sort 'n'
records whose keys range from 1...k in O(n) time using only an
auxiliary array of size k. The algorithm should sort be stable
Thanks!On 4/27/06, Gene [EMAIL PROTECTED] wrote:
Lukas Šalkauskas wrote: oh thats!, maybe you can give me some examples? or maybe some links with good information about it.You asked for the best way, not for code!-
#include stdio.htypedef struct node {
Dhyanesh:
I am failing to see your point.
Imagine a circle with origin as the center. You can very well imagine
two chords parallel to x-axis. Say one is diameter and the other is
some chord little above the diameter. These two don't intersect. How
can two parallel chords in a circle intersect?
Hi Gene,Thanks for the cool code!Cheers,NatOn 4/26/06, Gene [EMAIL PROTECTED] wrote:
Lukas Šalkauskas wrote: oh thats!, maybe you can give me some examples? or maybe some links with good information about it.
You asked for the best way, not for
16 matches
Mail list logo