Hi, I need to program a Lisp function that finds the longest path between two nodes, without revisiting any nodes. Though, if the start and end node are the same, this node can be revisited. The function needs to be both recursive and depth-first-search.
I've been trying to get at this for hours, and cannot come up with a solution. I kn...
I'm working on a hybrid data structure that is an ordered double-linked list where each node contains an array[] of SIZE. My difficulty is the add method.
Using unit testing provided by the professor, a test string is broken up into individual characters and added to the list using a provided comparator. The default test is abcdefghij...
What is File Expansion?
In many computer languages (be they for programming, text formatting or some other application) you can specify in a le A to include the expanded contents of some other file B. In C and C++ (which you do not need to know), this feature is implemented with the #include directive.
Suppose we have a file called root...
I'm having a little trouble building the grids for a Battleship game for my Java class. So far, I can easily make a for loop to add JPanel or JButton objects to the JFrame. However, my issue is that I'll need to use those Panels or Buttons again when playing the game (such as clicking on a button to see if your opponent put a ship on tha...
I'm currently in a class on systems software development. We are writing the two-pass assembler for the assembly language of a fictional machine. We've implemented the tokenizer, and all of the classes that we need to abstractedly represent this program - all that is left (besides implementing the code generator in a later phase) is to p...
Recently I challenged my co-worker to write an algorithm to solve this problem:
Find the least number of coins required that can make any change from 1 to 99 cents. The coins can only be pennies (1), nickels (5), dimes (10), and quarters (25), and you must be able to make every value from 1 to 99 (in 1-cent increments) using those co...
create two process which communicate using shared memory segment. The first process finds list of all processes on the system with their name, process id, number of files opened and total time running and creates a linked list containing this data about every process running in the shared memory.
The second process reads this linked list...
Hi!
I have to list folders and sub-folders from a given directory in DOS and Unix. I know i cand make this with DIR command, as follows: dir directory /ad /s, but the assignment tells me that I have to make it with find. It works with dir, but i have no idea how to make it with find. And I have to make it in UNIX too, so if you have som...
class MyStringBuffer {
//TODO explain: why you would need these data members.
private char[] chars; //character storage.
private int length; //number of characters used
public String toString(){
//TODO
//Hint: just construct a new String from the ‘chars’ data member
//and return this new String...
Hi, I'm a first year computer science student having a problem with part of an assignment. The goal of the assignment was to store the coefficients for a polynomial and find its roots using both an array and a linked list. I was able to successfully complete the array version; however the linked list is giving me a headache.
I am able ...
// Calculate the quarters of a set of integers
#include <iostream>
#include <vector>
#include <algorithm>
#include <conio.h>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::sort;
int main()
{
// Ask for a set of integers
cout << "Please input a set of integers: "
<< endl;
// Read the set of integ...
package homework5;
import java.io.*;
import java.util.Arrays;
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
MyStringBuffer strTest = new MyStringBuffer();
// FIX ME if you see the following string is not on the same line
System.out.println...
I'm writing a compiler from (reduced) Pascal into ARM asm. I'm at the second step of the process - after writing lexical analyzer now I'm working on syntax analysis with java cup.
I have written my grammar, but got 5 S/R conflicts, which are all very similar. Example:
Warning : *** Shift/Reduce conflict found in state #150
between a...
I have a C++ assignment to complete over the next couple of weeks. The task is to
read a line of input containing 3 scores between 0 and 89, and read a name from the same line.
Convert those scores to marks and give each student a grade depending on their marks.
My first cut has done all of this (albeit in a messy way) and now I am...
public class Matrix
{
public static int rows;
public static int colms;//columns
public static int[][] numbers;
public Matrix(int[][] numbers)
{
numbers = new int[rows][colms];
}
public static boolean isSquareMatrix(Matrix m)
{
//rows = numbers.length;
//colms = numbers[0].leng...
Does basename strip away \n at the end of path? For example basename("/home/user/apple\n") would basename return "apple\n" or "apple" without the \n? If basename doesn't get rid of the \n does anyone have any suggestions as to a means of getting rid of the \
...
I created a method called selectMode(); and I want that method to be able to select a different mode while running. For example I have to different displays but only one display will show and if I want to access the other display I want to be able to select it.
...
I'm working through an exercise sheet regarding interfaces, generics and abstract classes in Java. No matter what way I seem to code it, the class Exercise1 won't work. The question asked are commented in the code. Any help would be appreciated, I'm not sure if the error is in the Exercise one code or the implementation of the interface ...
Here is the draw function which draws the parts of the car, in this function car rims is checked and flag is checked, and i need to rotate the tire rim as i move the car. Something is not working since the rims are rotated but taken out from the car model, when i press up arrow key, but the car does move.
I also initialized self.fFlag =...
I asked about pipes in a previous question, got that working perfectly. However I had some questions about output redirection like >> in a shell normally does. There doesn't seem to be a whole lot of info on the Internet about it. Here is what I have so far. Is there a better/easier way to do this, it's messy and im not even super sure t...