Hi all! I'm doing this class assignment, using classic C, and am stuck with this problem about callback functions that take variable arguments count and type.
Basically, I'm working on a Hashed Tree (a tree where each of the nodes is a hash tree), and I have a certain traversal strategy that will be used multiple times for different pur...
I already have the code for how to convert a bidimensional one into a dimensional one, but I don't know how to do it vice-versa. Here's my code:
package laboratorio9;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int A[][];
int B[];
int...
I have a package called studentServer which contains two sub packages student and common.
The common folder has references to the student package and i would like to be able to compile this. How could i do this?
javac student\*.java - compiles the student package
but when i try something similar with the common package errors are thro...
I got this far:
def most_frequent(string):
d = dict()
for key in string:
if key not in d:
d[key] = 1
else:
d[key] += 1
return d
print most_frequent('aabbbc')
Returning:
{'a': 2, 'c': 1, 'b': 3}
Now I need to:
reverse the pair
sort by number by decreasing order
only print the le...
For my computing languages class, we've been assigned to read On the Design of Programming Languages by Niklaus Wirth. One of Wirth's main points is that programming languages should choose a few abstractions and stick with them.
I'm trying to brainstorm some more modern examples than the ones that Wirth gives (although they don't nece...
I have a Java assignment that uses components to build program. The teacher gave us a JAR we are to use to build the calculator using Eclipse. The JAR has 2 classes. We must import the JAR and use its classes.
I import the JAR:
import SWEB401_HW1.NumericOperation;
but when I try to create an object for the class, it gives me an err...
Hi
I'm working on a project for university which is essentially a re-working of the Space Invaders game with the rules changed a bit. So far I've got a main JFrame, containing a subclass of JPanel (for the background image) which contains another subclass of JPanel which I'm using for the sprites. However, when I run it the JFrame and t...
Hi everyone,
I have few files which I put in array.
I shuffle the files so that it can be displayed in random order.
How to know that array index 0 is actually image1.txt or image2.txt or image3.txt?
Thanks in advance.
String[] a = {"image1.txt","image2.txt","image3.txt"};
List<String> files = Arrays.asList(a);
Collections.shuffle(fi...
Hello,
I am doing some hardware work and I do not know what is the difference between a 4 way processor and an 8 way processor. Can please anyone clarify what does way mean?.
Thanks a lot.
...
Hi, i am a newbie learning sml and the question i am thrown with involves IO functions that i have no idea how it works even after reading it.
Here is the 2 questions that i really need help with to get me started, please provide me with codings and some explaination, i will be able to trial and error with the code given for the other q...
EDITED: Updated 3/23/09. See rest of post at bottom. I'm still having trouble with the indexer. Anymore help or examples would really help me out.
Write a class, MyCourses, that contains an enumeration of all the
courses that you are currently taking.
This enum should be nested inside of
your class MyCourses. Your class
...
Hi, i am a newbie learning sml and the question i am thrown with involves IO functions that i have no idea how it works even after reading it. Here is the 2 questions that i really need help with to get me started, please provide me with codings and some explaination, i will be able to trial and error with the code given for the other qu...
Hey,
I need to write a compiler. It's homework at the univ. The teacher told us that we can use any API we want to do the parsing of the code, as long as it is a good one. That way we can focus more on the JVM we will generate.
So yes, I'll write a compiler in Java to generate Java.
Do you know any good API for this? Should I use reg...
I'm trying to write a small program that prints out distinct numbers in an array. For example if a user enters 1,1,3,5,7,4,3 the program will only print out 1,3,5,7,4.
I'm getting an error on the else if line in the function checkDuplicate.
Here's my code so far:
import javax.swing.JOptionPane;
public static void main(String...
I'm new to Perl and am working on a project for school and am stuck.
Input: A given text file containing email addresses delimited by a space, tab, ",", ";" or “:” [can be on separate lines].
I am trying to read in the email addresses and put them into an array. I am able to parse the data on one line however if there are line breaks ...
I want to extract all possible sub-sets of an array in C# or C++ and then calculate the sum of all the sub-set arrays' respective elements to check how many of them are equal to a given number.
What I am looking for is the algorithm. I do understand the logic here but I have not been able to implement this one by now. :s
...
Hi I have a Question in prolog ,
I did it but its not showing answers When i ask about the brothers,sisters,uncles,aunts
This is what I wrote, what's wrong ?
/*uncle(X, Y) :– male(X), sibling(X, Z), parent(Z, Y).*/
/*uncle(X, Y) :– male(X), spouse(X, W), sibling(W, Z), parent(Z, Y).*/
uncle(X,Y) :-
parent(Z,Y), brother(X,Z).
au...
If I have the following predicate door, which declare that there is a door between the two rooms:
door(office, hall).
door(kitchen, office).
door(hall, "dining room").
door(kitchen, cellar).
door("dining room", kitchen).
And the predicate doorstate which declares the state of a door:
doorstate(hall, office, closed).
doorstate(hall, "...
Hi all
I have been trying to write a C program which generates all possible permutations of a string (eg 123 in code below). I succeeded but it generates some garbage values after each possible permutation. Please help me in finding the possible cause. Is it something to do with initialization?
Code:
#include <stdio.h>
void permute(c...
I want to construct a general tree in java in which one root node and which can have a n children and each node can contain sub trees. How do I get started?
...