homework

MC68000: Divide by 3

I'm using shift operations to divide a long word in register D3 by three and storing the result in memory address specified by A2: Move.L D1, D2, D3, -(SP) CLR.L D5 MOVE.B #1, D4 Loop LSR.L D2, D3 ROXR.L #1,D5 BCS DONE SUBI.B #1, D2 BLT Loop CLR.B D4 DONE ...

Implementation of Prim's Algorithm

For my CS class I need to implement Prim's algorithm in Java and I am having problems with the priority queue step. I have experience with priority queues and understand they work in general but I am having trouble with a particular step. Prim(G,w,r) For each u in V[G] do key[u] ← ∞ π[u] ← NIL key[r] ← 0 Q ← V[G] ...

2d arrays, input files... Error: empty String (?)

This is my assignment: link Here are my questions: How can I fix this error: Exception in thread "main" java.lang.NumberFormatException: empty String at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1012) at java.lang.Double.parseDouble(Double.java:527) at extracredit.Main.read...

Javabat catDog Help

public boolean catDog(String str) { int count = 0; for (int i = 0; i < str.length(); i++) { String sub = str.substring(i, i+1); if (sub.equals("cat") && sub.equals("dog")) count++; } return count == 0; } There's my code for catDog, have been working on it for a while and just cannot find out what'...

MC 68000 Register question

please can someone tell how i will approach this Question..thanks The contents of selected registers and memory locations are specified as follows; D1:2; D3:$80A3; D4:$91EF; D4: $91EF; A2:$00008000; SP: $9000; $ABCDEF7 stored at $8000; $00124300 at $7FFC for the following independent segments of code statements, determine the modifie...

Shift operation on MC68000

I'm using shift operations to divide a long word in register D3 by three and storing the result in memory address specified by A2: MOVE.L D1, D2, D3, -(SP) CLR.L D5 MOVE.B #1, D4 Loop LSR.L D2, D3 ROXR.L #1,D5 BCS DONE SUBI.B #1, D2 BLT Loop CLR.B D4 ...

Subrouting Question (MC68000) NEED HELP

i am writing a subroutine which that could be called to meet the following specifications; A company has a number of employees and a boss. They have a party with Pizza and pop if the number of employees is larger than 15, then the boss will pay $50 and each employee will equally share the remaining amount, else, the boss will pay half...

Sorting a linked list

I have written a basic linked list class in C#. It has a Node object, which (obviously) represents every node in the list. The code does not use IEnumerable, however, I can implement a sorting function? The language I am using is C#. Is there an example of this in C#? I am working from this sample: http://www.c-sharpcorner.com/UploadFi...

How you would you describe the Observer pattern in beginner language?

Currently, my level of understanding is below all the coding examples on the web about the Observer Pattern. I understand it simply as being almost a subscription that updates all other events when a change is made that the delegate registers. However, I'm very unstable in my true comprehension of the benefits and uses. I've done some go...

Why is my "cat" function with system calls slower compared to Linux's "cat"?

I've done this function in C using system calls (open, read and write) to simulate the "cat" function in Linux systems and it's slower than the real one... I'm using the same buffer size as the real "cat" and using "strace" I think it's making the same amount of system calls. But the output from my "cat" is a little bit slower than the ...

Can you help me figure out this algorithm?

I'm working on a homework assignment and as a "hint" we are told to find the following algorithm, and then prove it to the necessary answer. Let L(1), L(2), .., L(k) be sorted lists of n elements each. Give a O(kn logk) space algorithm that supports the O(log n + t) Locate operation, which returns the location of t items. Ideally, I wi...

MVC for desktop app with no data layer.

Hi all. Question might be tricky (because of its nature or my way of describing it), so really read this before answering. I have this app to write: a) desktop app; b) no data layer in sense of database, files or any other repository (no need to save, store or load data); c) app will have some computation algorithms implemented (Genet...

how to swap two integer number in ada83 using pass by address

how to swap two integer number in ada83 using pass by address ...

Web Services

A telecommunications website maintains details of a) Various models of mobile phones (like company(NOKIA,SONY etc.), Model Number, Description, Price) b) Registered members of the website (memberid, password) Discount of 5% is offered if you are a registered member of the site. Develop web services using .NET to i) Get the discounted pri...

Determining the amount of time processes spend Blocking/Executing

OK so for a programming assignment that I have (Yes, we are all allowed to turn to any source we find suitable for help) I have to find out how much time processes spend blocking/sleeping/running. My first attempt was creating a bash script... that looked something like this: for i in `ls /proc/ | egrep [0-9]+` do cat /proc/$i...

How to use system calls like fork, wait and exit in C to solve my problem?

I have this problem to solve that I have no idea how to do it because there's only a few system calls we can use to solve it and I don't see how they are helpful for the situation. The Exercise: I have matrix with size [10][1000000] with integers and for each line I create a new process with fork(). The idea of each process is to go thr...

Java: Can't get incremented value to print.

I'm learning to do some Java 101 syntax stuff. In an exercise I'm trying to do, I can't get the incremented value to print. Any ideas? Here is my code: class StaticTest { static int i = 47; } class incrementable { static void increment() { StaticTest.i++; } } class DataOnly { int i; double d; boolean b; ...

Garbage Collection

In a lay-man terminology how to define garbage collection mechanism. How an object is identified to be available for garbage collection? In lay-man terms define GC algorithms i.e. Reference Counting, Mark and Sweep, Copying, Train etc? ...

x86 jump to an address

As an assignment for a security class, I am trying to use __asm__("jmp 0xbffff994"); in my code, but when I disassemble things in gdb, the instruction is changed to jmp 0xc8047e2a. Any idea why and how can I jump to a particular address? ...

C++ Segregated Free Lists

I need to use segregated free lists for a homework assignment and I was wondering if the STL or some other library had these already written so I don't have to reinvent the wheel? ...