homework

Java binary tree which return type for iterator over nodes, interface or class?

I'm writing a class for a binary tree, and in the tree interface this function is defined: /** Returns an iterable collection of the the nodes. */ public Iterable<Position<E>> positions(); The problem is that the type of the node is MY class implementing the position interface in the task. Not the interface itself, Position. That ...

HD Regular Expression Search

I am working on a project for my computer security class and I have a couple questions. I had an idea to write a program that would search the whole hard drive looking for email addresses. I am just looking for addresses stored in plain text since it would be hard to find anything otherwise. I figured the best way to find addresses would...

Pointers, memory allocation: index of rows in Matrix Multiplication (C Programming)

I'm having trouble understanding what an "index of rows of a" in the problem is referring to... can you give me an example of that? Why does sum = sum + a[(row * a_cols) + k] * b[k * b_cols + col]? Thank you! double dotProduct(double a[], const unsigned a_rows, const unsigned a_cols, /* a is a matrix with a_rows ro...

Quicksort not working

This is all my code for my quicksort method, it works on a set of 21 numbers, but not on my real data set, which is about 100000. I have no idea what is wrong, I've been fiddling for two hours and it is due soon! Any help would be very welcome public static void hybridQuicksort( int[] a, int start, int end ) { final int MIN = 13; if (...

Edit Distance Algorithm

I have a dictionary of 'n' words given and there are 'm' Queries to respond to. I want to output the number of words in dictionary which are edit distance 1 or 2. I want to optimize the result set given that n and m are roughly 3000. Edit added from answer below: I will try to word it differently. Initially there are 'n' words given ...

constructing random "integer" tree - depth-first / breadth-first

Hi, This is my first ever attempt at writing a recursive function in c. The following-code works. I apologize for the long posting, but I am trying to be as clear as possible. I am trying to generate a tree where each node (inode) has an integer field "n". Correspondingly, each inode has an array of pointers to "n" other inodes. Func...

LNK2019 when converting an app to use DLLs

(Re-written for clarity) I have a multi-project solution that I am looking to convert from using .lib to .DLL files. I have created my declspec macros and applied it to **every class except for those in the project that creates the final .exe. The linker is throwing a fit on just about everything, however. I have set up to ignore err...

Java Algorithm for finding the largest set of independent nodes in a binary tree

By independent nodes, I mean that the returned set can not contain nodes that are in immediate relations, parent and child cannot both be included. I tried to use Google, with no success. I don't think I have the right search words. A link, any help would be very much appreciated. Just started on this now. I need to return the actual...

FFT in MATLAB ( I need help)

Could anybody please tell me whether I can perform this integration with FFT in MATLAB? How? Please answer as soon as possible with the details. Suppose there exists 2 rectangular planes, say, input accessed by x1 and y1 variables and the resulting plane is output accessed by tetax and tetay variables. This is the integral in pseudo-co...

Arrange numbers in ascending order using if and swap statement

How can I arrange numbers in ascending order using if and swap statements? Could someone give me some direction? ...

Drawing a triangle in an image in MATLAB

I need to draw a triangle in an image I have loaded. The triangle should look like this: 1 0 0 0 0 0 1 1 0 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 1 1 1 1 1 0 1 1 1 1 1 1 But the main problem I have is that I do not know how I can create a matrix like that. ...

Information about RAM management in OS Linux, protection programs

I'm writing a report and presentation for my college titled "Protection runtime program in RAM. Examples of work with the protected program." I'm using Linux. I divided my report into two parts: Description of technology managed RAM OS Linux - Allocated memory for applications - Protection stack for one application from other applica...

String index out of bounds? (Java, substring loop)

This program I'm making for a COSC course isn't compiling right, I keep getting the error: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 2 at java.lang.String.substring(String.java:1765) at VowelCount.main(VowelCount.java:13) Here's my code: import java.util.Scanner; public class V...

Context Free Grammar for Unary Addition

Given an alphabet of 1s I want to parse addition of the form 1^k + 1^j = 1^k+j This is pretty easy to represent with a pushdown automaton simply by pushing a 1 on to the stack on each of the first two 1s, and then popping on the last set of 1s. However, I can't seem to figure out how to represent this as a context free grammar, which...

c# pgm to implement a stack using multithreading with using join and lock

hi, i am new to c# and multithreading. please help me how to write a c# program to implement a stack of integers using join and lock statements... ...

Lisp: How to write a Higher Order Function

I have this problem to work on: The sum higher order procedure can be generalised even further to capture the idea of combining terms with a fixed operator. The mathematical product operator is a specific example of this idea, with multiplication replacing the addition of the summation operator. The procedure accumulate, started below, ...

Java Need help implementing an algorithm

This algorithm is so advanced for my basic programming skills that I just don't see how I could implement it. I'm posting this in a new question because I can't keep bothering the guy who gave me the algorithm alone about this in the comment section in the previous question. MaxSet(node) = 1 if "node" is a leaf MaxSet(node) = Max(1 + S...

Listing files in Java without using java.io

how to list files and directories in current directory without using java.io.*? ...

CSE 214 , Java, complex number help

This is a CSE homework, I was hoping there might be some friendly guys and gals out there that might take a quick look and see if it looks good to turn in, thanks Y'all. Here are the instructions and the code I wrote, -Kyle write a ComplexNumber class with: (1) a constructor which does not take any parameters (where the defaul...

Video game bookings datastore

The assigned homework problem needs a function to store a user-selected video game. This is a small school project, and I was wondering what would the best way to store the information. The program must access the video game bookings, but I think a database is a little overblown for such a small task. What would you do? ...