homework

Catching screen prints in Java

There's a class I'm working with that has a display() function that prints some information to the screen. I am not allowed to change it. Is there a way to "catch" the string it prints to the screen externally? Edit: it displays to the console. ...

Difference between Logarithmic and Uniform cost criteria

I'v got some problem to understand the difference between Logarithmic(Lcc) and Uniform(Ucc) cost criteria and also how to use it in calculations. Could someone please explain the difference between the two and perhaps show how to calculate the complexity for a problem like A+B*C (Yes this is part of an assignment =) ) Thx for any hel...

Algorithm for dividing very large numbers

I need to write an algorithm(I cannot use any 3rd party library, because this is an assignment) to divide(integer division, floating parts are not important) very large numbers like 100 - 1000 digits. I found http://en.wikipedia.org/wiki/Fourier_division algorithm but I don't know if it's the right way to go. Do you have any suggestions...

How can I transpose an image in Assembly?

Hi everyone I'm working on a project and I need to compute something based on the rows and columns of an image. It's easy to take the bits of the rows of the image. However, to take the bits of each column I need to transpose the image so the columns become rows. I'm using a BMP picture as the input. How many rows X columns are in bmp...

Trouble deciding return type of a method that returns a SortedSet

I am supposed to make a class that should be a container for an interval of values (like in mathematics). I have already decided that I'll use internally a SortedSet. One of the the things I'm supposed to implement is a method that "gets an ordered set with all the elements in the interval". class Interval { private SortedSet sort...

overflow technique in stack

int main(void) { problem2(); } void doit2(void) { int overflowme[16]; //overflowme[37] =0; } void problem2(void) { int x = 42; doit2(); printf("x is %d\n", x); printf("the address of x is 0x%x\n", &x); } Would someone help me understand why overflowme[37] =0; from the doit2 function will overwrite the value...

Object-oriented GUI development in python

Hey guys, new programmer here. I have an assignment for class and I'm stuck... What I need to do is a create a GUI that gives someone a basic arithmetic problem in one box, asks the person to answer it, evaluates it, and tells you if you're right or wrong... Basically, what I have is this: class Lesson(Frame): def __init__ (self, ...

Doxygen dependencies to manage during install

Hi, i am supposed to document my code with doxygen for a homework assignment, but i have problems getting doxygen to run. I have a Doxyfile provided, and have just installed doxygen on my machine. When i enter the command to run doxygen, "doxygen Doxyfile" I get the following error: failed to run html help compiler on index.hhp ...

Haskell "Source reduction"

I'm revising for an upcoming Haskell exam and I don't understand one of the questions on a past paper. Google turns up nothing useful fst(x, y) = x square i = i * i i) Source reduce, using Haskells lazy evaluation, the expression: fst(square(3+4), square 8) ii) Source reduce, using strict evaluation, the same expression iii) State...

Implementing Naïve Bayes algorithm in Java - Need some guidance

hello stackflow people As a School assignment i'm required to implement Naïve Bayes algorithm which i am intending to do in Java. In trying to understand how its done, i've read the book "Data Mining - Practical Machine Learning Tools and Techniques" which has a section on this topic but am still unsure on some primary points that are...

Very simple code for number search gives me infinite loop

Hello, I am a newbie Computer Science high school student and I have trouble with a small snippet of code. Basically, my code should perform a basic CLI search in an array of integers. However, what happens is I get what appears to be an infinite loop (BlueJ, the compiler I'm using, gets stuck and I have to reset the machine). I have se...

Need help with threads in a client/server

For college, I am developing a local relay chat. I have to program a chat server and client that will only work on sending messages on different terminal windows on the same computer with threads and fifos. The fifos part I am having no trouble, the threads part is the one that is giving me some headaches. The server has one thread for...

android bluetooth

can someone explain to me the concept behind using bluetooth my project in my studies is to make an android app using bluetooth, SQLLIGHT and google app the app itself is a very easy one but i just dont get the tools i need to use : how does the bluetooth works? is there a simple example ? the concept behind android GUI (i allready n...

Algorithm Question.. Linked List..

Hi, Scenario is as follows:- I want to reverse the direction of the singly linked list, In other words, after the reversal all pointers should now point backwards.. Well the algorithm should take linear time. The solution that i have thought of using another datastructure A Stack.. With the help of which the singly linked list would ...

Recursion problem in algorithm

I'm not sure if this is the right place to post this, but the problem actually belongs to a programming assignment. Solve the recursion: T(0) = 2; T(n) = T(n-1) + 2; Solution: T(n) = 2(n+1) Could someone please show me how they got to that solution? ...

how does the setup of the program is created

Hello, I want to create the setup of my own program .Is i possible to create the setup of any program including the window and gui based program . i want to know how the setup of the program is created in the c# .. plz help . ...

Graph - strongly connected components

Hello! Is there any fast way to determine the size of the largest strongly connected component in a graph? I mean, like, the obvious approach would mean determining every SCC (could be done using two DFS calls, I suppose) and then looping through them and taking the maximum. I'm pretty sure there has to be some better approach if I on...

simple question regarding sorting

Given a array of random integers, sort the odd elements in descending order and even numbers in ascending order. e.g. for input (1,4,5,2,3,6,7) Output = (7,5,3,1,2,4,6) Optimize for time complexity. ...

1-DimArray Counting same elements (0,1)

Hello, I have a 1-dim array that fills up a table of 40 random elements (all the values are either 0 or 1). So i wanne "count" the largest row of the values net to each otherto each other.. Meaning for example : 111100101 => the longest row would be 1111 (= 4 elements of the same kind closest to each other). So 011100 would result in...

using dictionary to assign misspelled words to its line number

This is the code I have now from collections import defaultdict goodwords = set() with open("soccer.txt", "rt") as f: for word in f.readlines(): goodwords.add(word.strip()) badwords = defaultdict(list) with open("soccer.txt", "rt") as f: for line_no, line in enumerate(f): for word in line.split(): if...