I've faced three separate situations in C lately that I would assistance on:
My C code has a global variable:
int ref_buf; //declared in a header file
In a function definition I use the same name as a parameter:
void fun(int ref_buf, param2, param3)
{
}
Will it overwrite the originally defined global variable and will it cause b...
As a follow up question related to my question regarding efficient way of storing huffman tree's I was wondering what would be the fastest and most efficient way of searching a binary tree (based on the Huffman coding output) and storing the path taken to a particular node.
This is what I currently have:
Add root node to queue
while q...
This may seem like a simple question but i am getting an error when compiling this. I want to be able to pass an enum into a method in C.
Enum
enum TYPES { PHOTON, NEUTRINO, QUARK, PROTON, ELECTRON };
Calling the method
makeParticle(PHOTON, 0.3f, 0.09f, location, colour);
Method
struct Particle makeParticle(enum TYPES type, float...
I am used to the c-style getchar(), but it seems like there is nothing comparable for java. I am building a lexical analyzer, and I need to read in the input character by character.
I know I can use the scanner to scan in a token or line and parse through the token char-by-char, but that seems unwieldy for strings spanning multiple line...
Hello,
I've been trying to solve this for ages (3 days) now and I just cannot figure it out. I will try to explain the problem comprehensively because it is a bit more complex.
My school assignement is to create a simple text game using OOP in C# Visual Studio 2008 (should be built on a library the teacher provided for us). It should o...
The definition of library function strspn is:
size_t strspn(const char *str, const char *chars)
/*Return number of leading characters at the beginning of the string str which are all members of string chars.*/
e.g. if ‘str’ is “fecxdy” and ‘chars’ is “abcdef” then the function would return 3, since ‘f’, ’e’ and ‘c’ all appear somewhe...
Folks, here is an implementation of memset(), however I have been told that there is one logical mistake in the code. Could you help me find it.
I feel that a double pointer for the target string should be passed to this function, which will be like passing the address of the pointer variable and not the pointer itself.
I am getting a...
Hi, I'm writing an class for a hash table in java... can you please make sure that I am doing it correctly so far.
I need to store StudentRecord objects in it.... I am calculating the hash value based on the student's ID which is of type long...
package proj3;
import java.util.LinkedList;
public class HashTable {
LinkedList<Stu...
If I have an LinkedList of Employee objects...
Each employee has a Name, and an ID fields.
I have linkedList call list....
If I want to see if the list contains an employee I do:
list.contains(someEmployeeObject)
How about if I want to see if the the list contains an employee based on the imployee ID..
let's say I have the followi...
I'm working on this homework that's kind of confusing me...
I am provided with the following BinarySearchTree class
import java.util.NoSuchElementException;
/**
*
* @param <T> The type of data stored in the nodes of the tree, must implement Comparable<T> with the compareTo method.
*/
public class BinarySearchTree<T extends Compara...
I have to write program in C#,
that converts from C++ source code to C# code. Is there any idea where to start?
Do i have to use parser tree?
Thanks!
...
Please explain the difference between a binary search tree and m-way tree?
...
this the first time i use jsp, and i face some problems.
i want to know how to check teh login if i have to tyoe of login. for examplem i have the student and professor. when the anyone is login it should check if he student or professor to forward him to the right page, the student should go to the take_quiz.jsp page and the professor ...
I've got a function here that is meant to look through a list of tuples and find the second value in the tuple by taking in the first value. Here's the function so far:
lookup :: String -> [(String,String)] -> String
lookup _ _ [] = "Not found"
lookup x y zs = if (notFound x zs)
then "Not found"
else (head [b | (a,b) <- zs, (a==...
My teacher gave out a practice exam on java recently and I'm curious to see how I did on the true/false part. I'm least confident about number one, so any explanation there would help a lot.
In Java, a class can extend any number of abstract classes.
false. I don't quite understand why, is it just because in an inheriting class the...
so i made a circle class that sets the radius, and should output the radius, circumference and area however, if i input the radius, the radius, circumference, area wont output back, it just shows as 0.0
heres my Circle.java
public class Circle
{
private double radius;
private double PI = 3.14159;
public void setRadius(doubl...
How do I take a single ASCII character and convert it to its decimal equivelant in MIPs?
Do I simply have to have some conditions to subtract a certain amount from the ascii code to make it its decimal representation?
...
Well I have been working on an assigment and it states:
A program has to be developed, and coded in C language, to decipher a document written
in Italian that is encoded using a secret key. The secret key is obtained as random
permutation of all the uppercase letters, lowercase letters, numbers and blank space. As
an example, let us con...
i m writing a MiPS program that will examine a list of 15 test scores. And it is going to input from the terminal.Well, the passing criterion is the score of 50. the ouptuts to the terminal will include the scores in each category and the number of students passing and failing. with input prompts and output statements...Below is the prog...
I'm aiming to learn about concurrency in Java. Currently my state of knowledge is poor. I'm pretty sure I know what "volatile" means. I sort of know what "synchronized" means. Sometimes. I've never written code that starts threads or manages them. Outside of this issue, I feel confident and at home working in Java.
I'm looking for...