homework

Finding a wave graphic inside an image

Hi guyz, I need some help with a algorithm I'm working with for my college course. The idea is use an artificial neural network to read a electrocardiogram and try to recognize some disturbs in the waves, that's ok, I've the neural network and I can test it, no problem, but I'd like to give the function to the user to open a eletrocardi...

Creating a rectangle with vectors and points in java?

Hi, i have been given an assignment to create a class that defines 2 points. Then create a class that defines a vector. Then create a class that defines a rectangle (4 vectors). Prior to this assignment i was given the task to create a point and vector class to calculate the length of a vector. I had 100% marks on that assignment so i kn...

UDP Sockets in C

I'm working on a homework problem for class. I want to start a UDP Server that listens for a file request. It opens the file and sends it back to the requesting client with UDP. Heres the server code. // Create UDP Socket if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { perror("Can't create socket"); exit(-1); ...

Whats wrong with my UDP Client Server?

I have a UDP Server that should sit and wait for a client to connect to it, and send it a string of a filename. Right now I just want it to echo back the filename to the client. Here is my code Server #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <sys/types.h> #include <sys/s...

traverse a Binary search tree

I am trying to do a preorder traverse ...

Pointers in c (how to point to the first char in a string with a pointer pointing somewhere else in the same string)

If I have a pointer that is pointing somewhere in a string, let's say it is pointing at the third letter (we do not know the letter position, basically we don't know it is the third letter), and we want it to point back to the first letter so we can make the string to be NULL how do we do that? For example: if we have ascii as a pointe...

MIPS program! need help- i m not sure if i m doing it right.

i m trying to write a MIPS program that will examine set of ten single digit numbers (positive, zero,or negative) that can be inputted from the terminal. After examining the numbers, only the negative numbers (with appropriate sign) along with their count needs to be outputted to the terminal. BELOW IS MY MIPS PROGRAM .data pr...

Tryig to translate C code to MIPS assembly to work on spim

i wrote a code for computing factorial on C, however im trying to translate it to assembly language to work on PCspim but have no idea how?? can someone help please? C code: #include <stdio.h> #include <stdlib.h> #include <string.h> void factorial(long argument, long *result) { if(argument < 2) { printf("%ld", *result); ...

Complexity of finding all simple paths using depth first search?

Thanks to everyone replying with ideas and alternate solutions. More efficient ways of solving problems are always welcome, as well as reminders to question my assumptions. That said, I'd like you to ignore for a moment what problem I'm trying to solve with the algorithm, and just help me analyze the big-Oh complexity of my algorithm as...

Help Using Constructors for this situation? (C#)

Hello there, I'm in my first OOP class and I really like it, but on this assignment, I'm not really sure what the best (most efficient, less code, etc.) way to use constructors in this situation? Preferably using constructor chaining. A little more info: I would like my default constructor to create & initialize all the objects shown...

find the second largest element in the list

I know how to find the largest element of the list no problem, but how should I go about finding the second larget element? Say the predicate is secondlargest(+List,?Val) and succeeds if Val is the second largest element in the List. If there is a tie for largest, then second largest is the same as largest... I'm quite new to Prolog, ca...

MIPS Assembly assignment HELP!!

My closest friend is going through an EE course (I'm his last hope : /), I have knowledge of Java from about 7 years ago, but his (outline) latest EE programming assignment is to use the MIPS Assembly to do the following: Write a program that takes two positive integers (m and n) and computes: x= (m^n) - (1+2+3+…+n) * min(m,n)! Both...

How do I use the least squares approximation in MATLAB?

For a homework assignment in linear algebra, I have solved the following equation using MATLAB's \ operator (which is the recommended way of doing it): A = [0.2 0.25; 0.4 0.5; 0.4 0.25]; y = [0.9 1.7 1.2]'; x = A \ y which produces the following answer: x = 1.7000 2.0800 For the next part of assignment, I'm supposed to solve the ...

String relate source code

Question 1. I want to print my from the String s = " This is my house"; using core java? Question 2. I want to print house is my This from the String s = " This is my house "; using core java? ...

Towers of Hanoi-like problem

There are four stacks. On the first stack there are n numbers 1, 2, ... n in random order. The other three stacks are empty. The goal is to determine, given the state of the first stack, whether is it possible to move all the elements to the last stack so that they are sorted. Allowed moves are moving the element from the first stack to ...

Need some help with Javadoc....

Hello, I currently have create an application and need some help with writing my javadoc for it. Here is the code: import java.lang.*; import java.util.*; import java.io.*; import java.net.*; /** *@author Name HERE *@version 1.0 * The Assignment2App public class represents a menu application that will form * the base of the other sou...

Const correctness: const char const * const GetName const (//stuff);

Labelled as homework because this was a question on a midterm I wrote that I don't understand the answer to. I was asked to explain the purpose of each const in the following statement: const char const * const GetName() const { return m_name; }; So, what is the explanation for each of these consts? ...

Simple formatting question in Java using printf

I have an array of 12 numbers int ary2[] = {3,5,9,11,15,18,22,23,30,31,35,39}; I want to print the numbers out with 2 places for the number and a space between the numbers. Example print out would be : 3 5 9 11 15 18 22 23 30 31 35 39 This is how far I got. for(int i = 0; i < ary2.length; i++) { System.out.printf("%-3s"...

C Function exiting before input

I'm currently doing a project for a Beginner C programming class where i'm supposed to make a basic ordering system for a company. I've got an issue with one of my functions, it works fine as a separate program but as a function in the ordering program it won't let me input a new item before it exits the function. It seems however to ru...

Deductive Retriever Example

In Lisp, suppose I have these two rules in the knowledge base: (append nil ?x ?x) (<- (append (cons ?x ?l1) ?l2 (cons ?x ?l3)) (append ?l1 ?l2 ?l3)) Then how could I infer that if we ask (ask '(append (cons a (cons b nil)) (cons c nil) ?l) '?l)) we will get the result '((cons a (cons b (cons c n...