I've been presented the following problem in University:
Let G = (V, E) be an (undirected) graph with costs ce >= 0 on the edges e E. Assume you are given a minimum-cost spanning tree T in G. Now assume that a new edge is added to G, connecting two nodes v, tv V with cost c.
Give an efficient algorithm to test if T remains the minim...
I'm new to programming and as a school task I need to implement BFS, DFS and A* search algorithms in Java to search for a given Goal from a given start position in a Grid of given size, 4x4, 8x8, etc.
To begin with I don't know how to code the neighbors of all the nodes. For example in a 8x8 grid tile 1 has 2 and 9 as neighbors and Tile...
Given the char * variables name1 , name2 , and name3 , write a fragment of code that assigns the largest value to the variable max (assume all three have already been declared and have been assigned values).
I've tried and came up with this:
if ((strcmp(name1,name2)>0)&&(strcmp(name1,name3)>0)){
max=name1;
}
else if ((strcmp(...
Hi,
I need to write a non-recursive version of the function sum-squares and Use a do-loop that is based on the length of the argument list.
...
ok so basically i very new to programming and have no idea how to go about these problems
help if you will ^^
Numerologists claim to be able to determine a person’s character traits based on the “numeric value” of a name. The value of a name is determined by summing up the values of the letters of the name, where ‘a’ is 1, ‘b’ is 2, ‘c...
I'm having a bit of trouble understanding how to obtain the lookahead token for LR(1).
I'm hoping that someone can post a small example, and explain it to me.
Thanks for the help!
...
What I want to do: Create a game that starts with 3 green dots on the left and 3 red dots on the right with a space between them. The endgame should have the colors switched sid*e. The rules of the game* is that, if there is a space next to a dot it should be able to move there, also if an opposite color is next to it - it should be able...
This is a homework question and I'm having a lot of trouble with it - I've managed to do some of it but still cant finish it - can i Please get some help.
Q1. Bezier Curves
The following example allows you to interactively control a bezier curve by dragging the control points Cubic.java
Replace the call to draw the cubic shape (big.dr...
Describe the output of the following SQL query:
select custId, name
from customer
where region = "New York"
UNION
select cust.custId, cust.name
from customer cust
where cust.custId IN (select cust_order.custId
from customer_order cust_order, company_employee comp_emp
where cust_order.salesEmpId = comp_emp.empId
AND comp_emp.name = 'DAN...
P-> Q | ε
Q-> m | m Q
S0:
S' ->.P, $
P -> .Q, $
P -> ., $
Q -> .m, $
Q -> .mQ, $
< Arrow from S0 to S2 moving with m>
S2:
Q-> m., $
Q-> m.Q, $
Q-> .m, $
Q-> .mQ, $
< Arrow from S2 to S3 moving with Q>
S3:
Q-> mQ., $/m
Can someone explain how why the lookahead token "m" is in S3?
Thanks a lot for the help!
...
Besides making macros, what is VBA good for?
I'm in an intro programming class for Engineering, and I don't really see any use for it.
...
I need some help formulating a select statement. I need to select the total quantity shipped for each part with a distinct color. So the result should be a row with the color name and the total.
Here's my schema:
create table s
( sno char(5) not null,
sname char(20) not null,
status smallint,
city char(15),
pri...
I am a comsci student and I'm taking up database now. I got a problem in or should I say I dont know how to link table to table.
It is not like you'll just use a foreign key and connect it to the primary key. The outcome should be like this:
In the table Course there are three fields namely "course_id", "Description" and "subjects". ...
Hi Guys,
For one of my course project I started implementing "Naive Bayesian classifier" in C. My project is to implement a document classifier application (especially Spam) using huge training data.
Now I have problem implementing the algorithm because of the limitations in the C's datatype.
( Algorithm I am using is given here, htt...
how to implement producer consumer problem with multiple producers and multiple consumers??
how should we create threads?? Give me some overall idea..
Thanks in advance
...
How would I print the multiples of a list of given numbers in a merged, sorted list?
I.e.
take 10 (multiples [4,5])
gives
4,5,8,10,12,15,16,20,24,25
I've got it working for lists of size 2 or 1 but I need a more general solution :)
...
How can I rewrite the code below so that I don't need to have an extra reg mul. I just wanted to take the 32 bits of the resulting 32 * 32 bit multiplication and put it into Result
input signed[31:0] Reg1;
input signed[31:0] Reg2;
output[31:0] Result;
reg signed[31:0] Result;
reg[63:0] mul;
mul = Reg1 * Reg2;
Result = mul[31:0];
...
I have to create a program that finds all the possible ways of filling a square of size x by y. You place a block which takes up 2 spaces to completely fill.
The problem is I don't know how to code it to the point where you can remember the placements of each square. I can get it to where it fills the board completely once and maybe tw...
I want nearest 10 marks for particular student. For example John has marks 73 then i have to find 10 student with marks greater than 73 in ascending order nearest to John. My Table structure is (id,name,marks).
...
I am working on a python tetris game that my proffessor assigned for the final project of a concepts of programming class. I have got just about everything he wanted to work on it at this point but I am having a slight problem with one part of it. Whenever I start moving pieces left and right I keep getting "index out of range error". Th...