I'm using netbeans. ]]>

it is the solution ,but I dont know the steps,this is not homework,i just do the exercise, i have tried but it can't work

double p1x, p1y, p2x, p2y, x1, y1; //input varibles

double slope, YI, max1, min1, max2, min2; ////output varibles

System.out.print("Enter p1x: ");

p1x = in.nextDouble();

System.out.print("Enter p1y: ");

p1y = in.nextDouble();

System.out.print("Enter p2x: ");

p2x = in.nextDouble();

System.out.print("Enter p2y: ");

p2y = in.nextDouble();

System.out.print("Enter point 1x: ");

x1 = in.nextDouble();

System.out.print("Enter point 1y: ");

y1 = in.nextDouble();

slope = (p2y-p1y)/(p2x-p1x); // slope

YI = p1y -(slope)*p1x; // y intercept

if(p1x < p2x)

{

max1 = p1x;

min1 = p2x;

}

else

{

max1 = p2x;

min1 = p1x;

}

if(p1y < p2y)

{

max2 = p1x;

min2 = p2y;

}

else

{

max2 = p1y;

min2 = p2y;

}

if (slope *p1x + YI > (p1y - 0.01 ) && slope * p1x + YI < (p1y +0.01)

&& p1x >= max1 && p1x <= min1 && p1y >= max2 && p1y <= min2)

System.out.println("point lies on line");

else

System.out.println("point does not fall on the line"); ]]>

There is some number of people and each of them has time to go through gate. You can only go through gate with item. There is only one such item. There can only be max 2 people in gate at given time. I am looking for algorithm which finds the shortest path.

For example:

A: 1

B: 4

C: 5

D: 6

are on the left side with given time to go through gate. I think it can be good solution:

AB: 4

A backs with item: 1

AC: 5

A backs with item: 1

AD: 6

= 17.

Which algorithm can I use? Or how this problem is named so I can google it? ]]>

I am working on conversion of infix to postfix expressions, for this the precedence table that I have is like,

precedence order (descending 1 to 4) symbol (operator)

1 parenthesis ()

2 exponentiation ^

3 multiplication * and division /

4 addition + and subtraction –

It was well going, but today I got a new symbol (I don’t know operator or operand) ---- the dollar sign $,

I googled it and in youtube in a “Infix to Postfix Notation” tutorial at “https://www.youtube.com/watch?v=rA0x7b4YiMI” I got ”$ is for representing the power: Eg: 6$2 is equal with 6*6 = 36”

-------- OK I followed it but with this sometimes I got correct result and sometimes not for example,

Infix : A*B+C$ Postfix : A B * C$ +

Infix : A*B+C^ Postfix : A B * C^ + (same result for $ and ^)

Infix : ((A-(B+C)*D)$(E+F)) Postfix : A B C + D * - $ E F +

Infix : ((A-(B+C)*D)^(E+F)) Postfix : A B C + D * - E F + ^ (different results for $ and ^))

One more thing…….. I also want to know the correct algorithm to convert postfix to infix back (with and without parenthesis involved in infix expressions), what I got are algos that don’t take parenthesis into account. Please suggest me the links to books sites etc where I can get it with examples

Please help me as soon as possible, I am in a great need of it for my coming exams.

Please help.

Thanks in advance. ]]>

i want to ask:

1)

what is the corresponding time complexity in the Big-O notation from the table????

2)

Use only the Average Big-O time complexity to order f1, f2, and f3 for D1 and D2

respectively. For instance, for D1, f3 <=f1 <=f2. (hint: should have one for D1

and one for D2).

3)

Which one of the three function for each D1 and D2 is the most crucial in terms of

the affect on time complexity in the Worst case? explain plz.

anyone knows these 3 hard questions? dont know the answer:(

plz explain it with ans~~i am not so sure

anyone knows this question???

During a certain part of execution of my program, I need an overall "XML namespaces structure" of the XML file, that is for every XML node I need just its XML namespace (if you don't know modern XML, I can tell you that "XML namespace" is a certain URL (or if to be exact IRI) assigned to a node) and child nodes.

Well, to a node several namespaces may be assigned, because if an XML node has namespaced attributes then these namespaces are counted in my algorithm as additional namespaces of the node.

Moreover, I do not need the order of child nodes. Moreover, if the namespaces of two direct child nodes of a node X and all their descendants match, for me it is not important that a given node appears more than once.

What data structure I need to be able to efficiently process "XML namespaces structure"?

The first idea which comes to the mind is just a tree, whose nodes are sets of namespaces. But then two subnodes of a node X may be repeated more than once, even if all their descendants have matching namespaces. I suspect thus that it is not the most efficient implementation.

The next data structure D which comes to the mind is a record of a set of namespaces and a set of (child) values of D. At first this looks efficient, but when I think about generating hashes for a set of D, I realize that to generate a good hash, the entire subtree with all deescendants should be taken into account. This look inefficient.

So, what is the best data structure for this task?

If it helps, I am going to implement my algorithm in Ada2012 programming language. It is a free open source project: https://en.wikiversity.org/wiki/Auto...XML_namespaces ]]>