I'm a Java beginner so please bear with me :P
static int load = 100;
static int greet;
public void loadDeduct(int cLoad, int c){
int balance;
balance = cLoad - 7;
System.out.println("Your balance: " + balance);
}
public void loadDeduct(int tLoad){
int balance;
balance = tLoad - 1;
System.out.println("Your balan...
How to go about creating a Hashmap in C from scratch ?
What would be the parameters taken into consideration and what how would you test the hashmap as to how good it is ? As in what would be benchmark test cases which you require to run before you say that your hash map is complete.
...
Hi all! This is actually a non-critical question, but I get this warning most of the time I use function pointers and still couldn't figure out why on my own. Consider the following prototype:
typedef void * Pointer;
void tree_destroyLineage(Tree greatest_parent, void *dataDestructor(Pointer data));
And so far I can compile my thousan...
Hi there! I'm new to java so im having some "annoying" problems. I have a class Employee which contains a int idNumber and a int phonenumber. Then i have a LinkedList sorted by idNumber. I want to change the phonenumber of a certain idnumber.
I've been working with Iterators but i don't know if i'm doing it right, which i doubt.
public...
The structure of the linked list is
head.item = the number you want to sort
head.next = the next item
The only catch is that I need the singly linked list to sorted in constant space.
...
What is Ajax ? How does it work ? How to use it ?
What are the performance and security concerns and how to avoid them ?
...
Given 2 strings, write a function that returns the position of String B that matches String A if String A is a substring of String B. Otherwise return -1.
Example:
strA = "ello"
strB = "Hello_World"
Your function should return 1.
strA = "blah"
strB = "blha"
Your function should return -1.
...
Hello all,
I get the following error:
quicksort(int[],int,int)cannot be applied to(int[])
When I compile this:
import java.util.*;
public class Sort {
public static void main(String[] args){
Random rand = new Random();
int[] tab = new int[10];
for(int i = 0; i < tab.length; i++) {
tab[i] = rand.nextInt(100);
System.out.println(...
I am working on an exercise in Java. I am supposed to use / and % to extract digits from a number. The number would be something like 1349.9431. The output would be something like:
1349.9431
1349.943
1349.94
1349.9
I know this is a strange way to do but the lab exercise requires it.
...
I have to write a Matlab script that does this:
The input is 2 matrices, A(m x n) and D(m x 1). The output is a matrix, C (m x n). C is calculated like this:
function c = scanrow(a,d)
[rows columns] = size(d);
for i=1:columns
a(i,:) = a(i,:).*d(i);
end
c = a;
end
The requirement is not using recursion. I have no idea to solve this...
Some code for context:
class WordTable
{
public:
WordTable();
~WordTable();
List* GetListByAlphaKey(char key);
void AddListByKey(char key);
bool ListExists(char key);
bool WordExists(string word);
void AddWord(string word);
void IncrementWordOccurances(string word);
void Print();
private:
List *_listArray[33];
int...
I am working on BoundedBuffer class in consumer and producer we want to use the Semaphore in that class
we did that but there are an error in every use of acquire()
the rerror is:
unreported exception java.lang.InterruptedException; must be caught or declared to be thrown
Here is the code:
import java.util.concurrent.Semaphore;
publi...
I teach an introductory computer science course where there are some programming assignments.
The question is, what should we demand from the students other than correctness (i.e. the program works and does what we defined it should do) and originality (i.e. the student wrote it by himself).
...
hi,
My requirement is given a string as key to the map i should be able to retrive a structure.
Can any one please post a sample code for this.
Ex:
struct
{
int a;
int b;
int c;
}struct_sample;
string1 -> strcut_sample
...
Greetings.
I have a project for my Data Structures class, which is a file compressor that works using Binary Trees and other stuff. We are required to "zip" and "unzip" any given file by using the following instructions in the command line:
For compressing: compressor.exe -zip file.whatever
For uncompressing: compressor.exe -unzip...
I've been trying to troubleshoot a Castle ActiveRecord exception for days now. Whenever I attempt to access the database I get an exception with an InnerException value of "An attempt to attach an auto-named database for file database.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located o...
I want to print list of strings like shown below.
|Name|Country|Age|
------------------
|1 |USA |20 |
|2 |UK |19 |
I was able to achieve this using the following.
printfieldName :: [String] -> String
printfieldName [] = []
printfieldName (x:xs) = "|" ++ x ++ "\t" ++ printfieldName (xs)
Is it possible to achieve this usi...
I have a homework assignment to write a multi-threaded sudoku solver, which finds all solutions to a given puzzle. I have previously written a very fast single-threaded backtracking sudoku solver, so I don't need any help with the sudoku solving aspect.
My problem is probably related to not really grokking concurrency, but I don't se...
count repeated elements in an array.....
input is {1,1,1,1,2,2,2,3,3,4}
output is : 1=4
2=3
3=2
4=1
please help me to find out this.........
...
I am trying to compile and execute the c4.5 algorithm on my mac os machine (have a red hat enterprise linux 4.6 machine too), but have not been able to get anywhere with the same.
Is there any one who has tried this and succeed on getting the same to compile and execute on their machines? If, so, please can you share the steps?
...