So I have a Tree<E> class where E is the datatype held and organized by the tree. I'd like to iterate through the Tree like this, or in a way similar to this:
1. Tree<String> tree=new Tree<String>();
2. ...add some nodes...
3. for (String s : tree)
4. System.out.println(s);
It gives me an error on line 3 though.
Incompatible ...
Hello,
I have a set of N non-decreasing functions each denoted by Fi(h), where h is an integer. The functions have numeric values.
I'm trying to figure out a way to maximize the average of all of the functions given some total H value.
For example, say each function represents a grade on an assignment. If I spend h hours on assignme...
I know this probably really simple but Im not sure what im doing wrong...
The assignment states:
For the second program for this lab, you are to have the user enter an integer value in the range of 10 to 50. You are to verify that the user enters a value in that range, and continue to prompt him until he does give you a value in that r...
For this assignment I had to create my own string class. I initially wrote the compareto method to compare two string but return whichever is overall larger. What I want to do is compare and return which one is alphabetically larger i.e. comparing two strings, for example: smith and htims. With the way I designed the compareto method ...
Hi, this is for an assignment so I'm not looking for code.
I have to simulate a game where each player has turns and needs to 'pay attention' to what's going on.
So far, i know I'll need two threads for each player, one that will sleep until the player's turn and the other paying attention.
My question is: Should I work each player as...
Consider the following sequence of actual outcomes for a single static branch. T means the branch is taken. N means the branch is not taken. For this question, assume that this is the only branch in the program.
T T T N T N T T T N T N T T T N T N
Assume a two-level branch predictor that uses one bit of branch history—i.e., a one-bit B...
Hi All,
How can I use zlib library to decompress a PNG file? I have no idea how to read a PNG file. When I opened a PNG file in TextPad(a text editor), the data was not at all understandable. Is it because a PNG file is compressed?
Any help is greatly appreciated. I need to read a PNG file using a C program and gcc compiler.
Regards,...
hey ,
I'd like to make a recursive function using C++
I make this class
class linklist
{
private:
struct node
{
int data;
node *link;
}*p;
};
void linklist::print_num(node* p)
{
if (p != NULL)
{
cout << p->data << " ";
print_num (p->link);
}
}
in the main program what should I write ...
...
I'm very new to Unix, and currently taking a class learning the basics of the system and its commands.
I'm looking for a single command line to list off all of the user home directories in alphabetical order from the /etc/passwd directory. This applies only to the home directories, and not the contents within them. There should be no d...
I have a list of sales people and a list of their sale revenues in two separate columns. How do I use an advanced filter or other sorting means to find the max of the sale revenue column and then have the formula output be the corresponding sales person?
...
Given the following code
$c= new SoapClient('http://www.webservicex.net/CurrencyConvertor.asmx?WSDL');
$usa = "USD";
$eng = "GBP";
doing a __getTypes on the client gives me
Array ( [0] => struct ConversionRate { Currency FromCurrency; Currency ToCurrency; } [1] => string Currency [2] => struct ConversionRateResponse { double Conve...
What would you rather choose to implement deque: HashSet or LinkedList. And could you state cons and pros for both please?
Thank you.
...
public class MyFrame extends JFrame
{
public MyFrame(String title)
{
setSize(200, 200);
setTitle(Integer.toString(super.getSize().width));
setLayout(new FlowLayout());
for (int i = 0; i < 5; ++i)
{
JButton b = new JButton();
b.setSize(90,50);
b.setText(Integer.toString(b.getSize().width));
...
I am doing a project in Verilog, and the project is a low power parallel multiplier. I am going to fed the codings in FPGA kit. I need model Veriog codings. In which site can I get or suggest some good books.
...
I've got the following table:
patients
id
name
diagnosis_id
What I need to do is get all the patients with N most popular diagnosis.
And I'm getting nothing using this query:
SELECT name FROM patients
WHERE diagnosis_id IN
(SELECT TOP(5) COUNT(diagnosis_id) FROM patients
GROUP BY diagnosis_id
ORDER BY diagnosis_id)
How to fix it?
...
#include <stdio.h>
//Here use a macro definition that assigns a value to SIZE (for example 5)
int main()
{
int i;
int array[SIZE];
int sum=0;
for(i=0; i<SIZE; i++)
{
//Here use a macro definition named as CALCSUM to make the
//following addition operation for the array
...
Hey all, I'm trying to write a program that takes a large file (of any type) and splits it into many smaller "chunks". I think I have the basic idea down, but for some reason I cannot create a chunk size over 12 kb. I know there are a few solutions on google, etc. but I am more interested in learning what the origin of this limitation ...
I was writting a program that can read a set of numbers file called dog.txt;
and also writes to two file separating odd and even. i was able to compile my program however, the output expected is not the same which was supposed to be even numbers in one file called EVEN, odd numbers in file odd.
#include <stdio.h>
#include <stdlib.h>
in...
I'm using R5RS Scheme and I just want to implement a function that returns the intersection of two given lists, but I can't do that because I cannot add an element to a list. Here is my code. How can I fix it? I'm really a beginner in Scheme - this is my first work using Scheme.
thx in advance..
(define list3 '())
(define (E7 list1 lis...
As part of a homework assignment in Lisp, I am to use apply or funcall on any predicates I find. My question (uncovered in the coursework) is: how do I know when I've found a predicate in my list of arguments? I've done some basic google searching and come up with nothing so far. We're allowed to use Lisp references for the assignment...