"Find the two largest values among the 10
digits entered. p.s. Use 'prompt' to get the integer from user."
I would like to solve this question by "array", not "if", what should I do?
I have tried, but error.....
<script type="text/javascript">
var a, b, c;
var arr = new Array[3];
arr[0] = a;
arr[1] = b;
arr[2] = c;
a = window.prompt("...
Hello, I've got a project for school where I have to find out how many cache misses a filesystem will have under heavy and light loads and on a multiple processor machine. After discussing this with my professor, I came up with a basic plan of execution:
Create a program which will bog down the filesystem and fill up the buffer cache.
...
I am now looking at my old school assignment and want to find the solution of a question.
Here is the question:
Which sorting method is most suitable for parallel processing?
Bubble sort
Quick sort
Merge sort
Selection sort
I guess quick sort (or merge sort?) is the answer.
Am I correct?
...
I am having a runtime error that states Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at Status.copyState(Status.java:29) This is a class that is call the an instance of the Status calls (st): Main class is:
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
/**
*
*
* @author (Jason Sizemor...
This is homework :-)
Write a function that counts the number of elements in the list that are larger than or equal to the average (using integer division for simplicity).
Using just a single traversal of the list structure!
I already have a solution to this, BUT it involves ref variable changed from closure foo'.
I'm interested in a...
I have a class that reads the state of what string is in a JTextFeild (displayBox is the class in this case). The method sould read the state put it into an ArrayList (lastState in this case) and the be able to put it back into the JText feild when a method is called (returnState in this case)
displayBox is a object of class Jtextfeild d...
Hi. I'm a little behind in my X86 Asm class, and the book is making me want to shoot myself in the face. The examples in the book are insufficient and, honestly, very frustrating because of their massive dependencies upon the author's link library, which I hate. I wanted to learn ASM, not how to call his freaking library, which calls mor...
I have the following assignment for homework.
Requirements
design a class called TokenGiver with the following elements:
a default constructor, a parametrized constructor that takes an int
a method that adds a specified number of tokens to the number of tokens
a method that subtracts exactly ONE token from your number of tokens
a m...
Given a array of number, is there a O(n) algorithm to build a max-heap?
...
I have the following code:
//Comp454 program 2
#include <iostream>
#include <string>
#include <fstream> // file I/O support
#include <cstdlib> // support for exit()
const int SIZE = 60;
int main()
{
using namespace std;
string states;
int numStates = 0, i = 0, stateVar = 0;
string line;
char filename[SIZE];
ifstream inFSM, inStri...
I have tried but failed to do so. Could I have a push in the right direction?
...
I have this Code, i ran this on Java and C ,but they give me two different Results
What is that makes them to run differently.
x=10;y=10;z=10;
y-=x--;
z-=--x;
x-=--x-x--;
The Output in java for value of X is : 8
and for C it is 6
How these Two compiler Behaves differently for incremented options.?.
...
Got this as an homework assignment and not really sure where to start!
Given the set {1,2,3,4}, you can form six combinations of length two from that set, viz:
{1,2},{1,3},{1,4},{2,3},{2,4},{3,4}
If I was to choose one of the combinations, ({1,2} for example), how can I tell how many of the others are not disjoint to it? In this cas...
I am trying to implement Median of Medians in Java for a method like this:
Select(Comparable[] list, int pos, int colSize, int colMed)
list is a list of values of which to find a specified position
pos is the specified position
colSize is the size of the columns that I create in the first stage
colMed is the position in those columns...
I have 100 points to dole out to a set of items. Each item must receive a proportional number of points relative to others (a weight). Some items may have a weight of 0, but they must receive some points.
I tried to do it by giving each item 5 points, then doling out the remaining points proportionally, but when I have 21 items, the a...
I need to implement a search feature into my program. At present it reads from a file one line at a time, like so:
public void importContacts() {
try {
BufferedReader infoReader =
new BufferedReader(new FileReader("../files/Contacts.txt"));
txtName.setText(readLine(infoReader));
txtPhone.set...
For one of my beginning CS classes, we are going over "truth functional logic."
My question pertains to English translations. Note that ^ is AND; v is (inclusive)OR; ~ is NOT. -> is IF
Well, we had this: "RENT being paid is a necessary condition for staying in BUSINESS"
RENT -> BUSINESS
Whenever we graded everything this was wron...
In my programming class we currently have a project that requires us to take arguments into the program. I then need to be able to check one of the arguments to see which value was passed to the program so that I can choose the appropriate behavior for the program to follow. In a previous homework assignment I did this with the strcmp fu...
I am sorry, that I am bringing my school stuff here, but I am out of ideas.
I am attending an "advanced UNIX programming" course, and we have to make a proposal for the program, which, if accepted, we have to finish later and will get credits.
The thing is, I try to think something original, but I can't think of anything that is both i...
Formulate the steps of identifying the median from five unique numbers and visualize them in flow chart.
Develop an application that shows the median after getting five unique numbers from users.
Extend the feature for allowing six unique numbers input and computing the median.
Example:
Input: 5 4 2 1 10
Output: Median = 4
I found th...