homework

Number of bits in a data type

I have two tasks for an assignment, one return the number of bits in type int on any machine. I thought I would write my function like so: int CountIntBitsF() { int x = sizeof(int) / 8; return x; } Does that look right? The second part is to return the number of any bits of any data type with a macro, and the macro can be ...

Need Ontology of software engineering terms

I'm trying to implement a Question Answering System based on software engineering ontology. This is a [class/university?] project; it will use the java language. Can you please help me locate software engineering ontologies i.e. ontologies [or even taxonomies / folksonomies ?] that include words and concepts found in the domain of Soft...

Inserting elements into Binary Min Heaps

If I am inserting items: 10,12,14,1,6 into a binary min heap one item after another how would the results look like, my problem is with the following when i start i have: 10 then 10 / 12 then 10 / \ 12 14 then 1 / \ 10 14 / 12 but this is not right, so what is the right way to do that? Note: this is a...

Converting random numbers into XY coordinates for graphing

My professor gave us an assignment to test the difference in runtimes and search sizes using linear & binary algorithms, and the data is to be graphed. I have the search methods put the runtime & array sizes as Points in an ArrayList, which is then sent to the GraphResults class for plotting. I need to convert those data points into xy...

Is log(n!) = Θ(n·log(n))?

This is a homework question. I'm not expecting an answer, just some guidance, possibly :) I am to show that log(n!) = Θ(n·log(n)). A hint was given that I should show the upper bound with nn and show the lower bound with (n/2)(n/2). This does not seem all that intuitive to me. Why would that be the case? I can definitely see how to...

What is the name of this Balanced Binary Tree?

BBTHMNN(h) = Balanced Binary Tree Have Minimum Number Of Nodes BBTHMNN(h) = BBTHMNN(h-1) + BBTHMNN(h-2) + 1 Name of the balanced binary tree which satisfying the above formula. I have searched all over the internet but I couldn't found the name of the tree ...

Java, replacement for infinite loops?

I am making a program that shows cellular growth through an array. I have gotten it so when I press the start button, the array updates every 10 seconds in a while(true){} loop. The problem with that is I want to be able to stop the loop by pressing the pause button, but while in the loop, it wont let me use any of the controls. I need s...

Query direction issue

Hi, I am stuck at the start of a small project and I am not sure what would be the best way to go with a query etc. The story is that I have a table with members predictions on a particular sport. They have predicted the top 5 places of each event (about 19 events in total). Some of these predictions have been entered more than once as...

Implementation of DPLL algorithm in Prolog

I'm trying to apply the simplified algorithm in Prolog, but I'm not a Prolog master. I need it without any mistakes, so I thought you guys might be able to help. What is the implementation of DPLL algorithm in Prolog? ...

verilog basic questions

How do I write a Verilog code that declares a 12-bit by 16-word memory called x? How do I write a Verilog code that assigns the fifth word of mem1 the decimal value 127 on the positive edge of the signal clock. I am not clear on what word here means in terms of verilog, can someone give an example. ...

Which of these statements about objects is true?

Given this: struct { int x; } ix; struct A { A() {}; int x; }; A ia; Which of these is true? a. ix is an object b. ia is an object c. both are objects d. both are not objects. ...

how java.bigInteger valueOf works ?

I'm making a project concerned big numbers without BigInteger, BigDecimal etc. I've managed to do all the basics but now I need to add ability to count factorials. My BigNumber stores data as int[] . Here's a sample solution with BigInteger but I can't use it without having the actual value of my number. BigInteger n = BigInteger.O...

Assembler task - min and max values of the array..

Hi. I've encountered problems with assembler code. I'm a newbie to assembler, so it seems difficult for me to solve it myself. The task is: "To find minimal and maximal elements of the array." All I've already done is searching for maximal element. I can't find out, how to make check for the minimal element and where I should put suc...

simple php counter

Hi , I have a loop but I need to say that every time $i is printed the value of $i is a number so the start $i will be = 0 and at the end after 20 $i's it will be $i = 20 I hope some one can help Thanks ...

Java: implementing a list

So I'm learning Java and I want to implement a singly-linked list, but when I try to print it, it goes into an infinite loop, printing only the first element, as if the temp doesn't get reassigned. What's wrong here? public class Cons { public int stuff; public Cons next; public Cons(int i) { this(i, null); } public void show() { ...

wire equation in verilog

If say I have the following wire set-ups, is the wire assignment all valid? wire[3:1] w; wire w1; wire [1:0] w2; A) w1 = w[2]; B) w2 = w[1:0]; C) w2 = w[1:2]; I am guessing that everything is valid.... ...

verilog debugging

I don't know what is wrong with the code below, can someone help me debug module iloop(z,a); input [31:0] a; output z; reg [4:0] i; reg s, z; initial begin s = 0; for(i=0; i<32; i=i+1) s = s | a[i]; z = !s; end endmodule ...

Python: Elements not in a list

So heres my code: item = [0,1,2,3,4,5,6,7,8,9] for item in z: if item not in z: print item Z contains a list of integers. I want to compare item to Z and print out the numbers that are not in Z when compared to item. I can print the elemtens that are in Z when compared not items, but when i try and do the opposite using t...

Python: Replacing item in a list of lists

Heres my code: data = [ [5,3,0,0,7,0,0,0,0], [6,0,0,1,9,5,0,0,0], [0,9,8,0,0,0,0,6,0], [8,0,0,0,6,0,0,0,3], [4,0,0,8,0,3,0,0,1], [7,0,0,0,2,0,0,0,6], [0,6,0,0,0,0,2,8,0], [0,0,0,4,1,9,0,0,5], [0,0,0,0,8,0,0,7,9] ] element = 4 x = 0 y = 0 data[x][y] = element I want to replace the element at coordinates 0,0 but when i print data i...

schematic from verilog code

what does the schematic looks like in the following verilog code? module mystery2(s, c, x, y, z); input x, y, z; output s, c; assign {c, s} = x + y + z; endmodule I know that {c, s} means that they are concatenated, what does this looks like in schematics? and x + y + z is just an add between the three input right and we have ...