homework

Has anyone solved a programming puzzle similar to this?

"Suppose you want to build a solid panel out of rows of 4×1 and 6×1 Lego blocks. For structural strength, the spaces between the blocks must never line up in adjacent rows. As an example, the 18×3 panel shown below is not acceptable, because the spaces between the blocks in the top two rows line up. There are 2 ways to build a 10×1 pane...

How to represent this sentence in description logic ?

How to describe this in description logic? "every human is either male or female" Thanks ...

How does skolemisation of lone EXISTS clauses work?

Hi, If I have a formula like: FAx FAy (Ez(!A(x,z) v !A(y,z)) v B(x,y)) (FA = For All / E = Exists) The rules of skolemisation say that: if E is outside FA replace with a constant or if E is inside FA replace by a new function contain all the vars from outside the FA as arguments. So what do I do in this case? Can I just drop t...

How can I delete a node from the middle of a C++ queue?

I have a linked list with a c-style ctor and dtor. I just got too frustrated when this if statement decided not to test true, putting me in an infinite loop. I dont understand why it will never test true. I am trying to delete a node (the address of a class object) from my LinkedList. Maybe someone could help me out? Node *Current = ...

how to get the path of server's folder inside Java program (J2EE + JSTL)

I wanted to read contents excel files in my web-based project(J2EE-JSP+Servlets) which are located inside the web server's folder.. So, I have made a java file, which i will call through a JSP page using JSTL library. I need to have the path of excel sheet in that java file, so that i can read the contents of that excel sheet. The exc...

C++ Deleting a node in Queue

Problem1: Deleting in a node in a list > 3 Description: Deletion of the sixth node in a list of seven, results in a print of only the first and last node. Available Node Pointers: next, prev, data Function to delete the specified node is in the LinkedList.cpp Name: DeleteNode. Function that traverses through the list to print the no...

What is difference between windows drivers and linux drivers?

What is difference between windows drivers and linux drivers? Are they written in the same languages? ...

XNA collision detection

I have a ball moving inside a cube, and I detect when it goes outside of the cube (with a bounding sphere and a bounding box). Now I would like to detect from which side the ball goes out. Then I could redirect the ball in the correct direction. How can I do this with the ball's “world” matrix? Should I keep track of the ball's coordina...

How to get data from Set in one go

I want to get all values of a set interface in one go as a comma separated string. For Example(Java Language): Set<String> fruits= new HashSet<String>(); fruits.add("Apple"); fruits.add("Banana"); fruits.add("Orange"); If I print the set as fruits.toString then the output would be: [Apple, Banana, Orange] But my requirement is A...

Parse a String in C

Using just C I would like to parse a string and a) count the occurrences of a character in a string (so i.e. count all the e's in a passed in string) b) Once counted (or even as I am counting) replace the e's with 3's Thanks. ...

What is a good algorithm for getting the minimum vertex cover of a tree?

What is a good algorithm for getting the minimum vertex cover of a tree? INPUT: The node's neighbours. OUTPUT: The minimum number of vertices. ...

Deleting a heap then dereferencing a pointer to that memory

This is code from an exercise: #include <iostream> using namespace std; int main() { int n = 13; int* ip = new int(n + 3); int* ip2 = ip; cout << *ip << endl; delete ip; cout << *ip2 << endl; cout << ip << tab << ip2 << endl; } When the space allocated to the int on the heap is deleted, I thought that dere...

Need to calculate the distance between two points???

Hi, i need to create a class which calculates the distance between two points. I am stuck and i am a total beginner. Here are my classes: package org.totalbeginner.tutorial; public class Punkt { public double x; public double y; Punkt(double xkoord, double ykoord){ this.x = xkoord; this.y = ykoord; } ...

Why does "delete node;" crash my C++ linked list application?

The jDeleteAfter method of my linked list class is supposed to delete the node immediately following the node passed as an argument. If it is doing that, I do not know, but it is abruptly closing my console application when "delete tlp;" (Temp List Pointer) gets read. My instructor, the users of a programming forum and I have yet to de...

what is wrong in this ruby code?

n=0 k=[] q=[] j=0 if n!=-1 p=gets n=p.to_i for i in (1..n) l=gets k[i]=l.to_i a=a+k[i] end if a%n !=0 q[j] = -1 continue end a=a/n for i in (1..n) if k[i] >a q[j]=q[j]+(a-k[i]) end end j=j+1 end for i in (1..j) puts(q[j]) end it ...

finding a function name and counting its LOC

So you know off the bat, this is a project I've been assigned. I'm not looking for an answer in code, but more a direction. What I've been told to do is go through a file and count the actual lines of code while at the same time recording the function names and individual lines of code for the functions. The problem I am having is dete...

SQL Join and Count can't GROUP BY correctly?

Hi, So let's say I want to select the ID of all my blog posts and then a count of the comments associated with that blog post, how do I use GROUP BY or ORDER BY so that the returned list is in order of number of comments per post? I have this query which returns the data but not in the order I want? Changing the group by makes no diff...

displaying random numbers

Hello I'm trying to design a code where one guess a number. I defined the range which number to display in my listbox. I started to write Random(1,10) but if I enter 11, it still writes in my listbox. How can I just write the number selected from my range, which is 1-10? I'm quite lost here. Any ideas? Thanks here is a part of my code...

Dijkstra algorithm for 2D array in Java

Hiya guys!! This is my first post, and this is for a school project; I'm running into a huge amount of trouble, and I can't seem to find a understandable solution. a b c d e z a - 2 3 - - - b 2 - - 5 2 - c 3 - - - 5 - d - 5 - - 1 2 e - 2 5 1 - 4 z - - - 2 4 - Thats the two dimensional array. So if you want to find the shortes...

Using stringstream in place of string? - C++

I've been given a homework assignment to write a program in C++, but we're not allowed to use the string class. However, we are allowed to use the iostream library, including stringstream. I was thinking of using stringstream where I would have used string for building my classes, returning from functions, etc. Does this sound like a go...