I have a MATLAB assignment due in an hour, and I wrote it all in MATLAB 7. One of my friends who took the assignment said that it is not working on MATLAB 6.1 as functions like dirac are not defined. I only just found out that the MATLAB version used for evaluation is 6.1, and I have no idea how to fix my code. Can anyone help by pointin...
I did the following algorithm involving a Binary Heap structure:
Algorithm: heapMinimum(node)
Input : Position n
Output : Sequence minList; containing the postions that hold the minimum value
1. minList <-- sequence
2. if parent(node) == NULL // current node is the root of the tree
3. minList.insertLast(node)
4. if (leftchild(no...
how can i make a client able to send smilies to other clients?
...
Hello,
I'mm using flex builder 3.
I have an xml file that looks like this, notice the flag property. It can be either 0 or 1:
<question id="2">
<short>OMG</short>
<meaning>Oh My God</meaning>
<hint>OMG did you hear they broke up?!</hint>
<flag>0</flag>
</question>
<question id="3">
<short>BTW</short>
<meaning...
I have been attempting to write a program that will determine if a number is prime or not. I have based it off of the Sieve of Eratosthenes. Anyway, my program works for small numbers (15485863 works), but if I use large numbers (ex. 17485863) I receive a segmentation fault. I am using unsigned long longs and do not think I have surpasse...
I have a small program:
#!/user/bin/perl
use strict;
system ("clear");
my($option, $path);
do
{
print "\tEnter the number of your chosen option:\n";
print "\n";
print "\tOption\t\tCommand\n";
print "\t======\t\t=======\n";
print "\t1\t\tDate\n";
print "\t2\t\tDirectory Listing\n";
print "\t3\t\tCalendar...
Here's my code ... i do not know how to convert linkedlist of doubles to array . Please help me find the error.
import java.util.*;
public class StackCalculator {
private LinkedList<Double> values;
double value1 , value2 ;
public StackCalculator()
{
values = new LinkedList<Double>();
}
void push(double x)
{...
if right[x] != NIL
then return TREE-MINIMUM(right[x])
y<-p[x]
while y!= NIL and x = right[y]
do x<-y
y<-p[y]
return y
I know what "if right[x] != NIL then return tree-min" means and I've translated it to:
if(p->RChild) return fMinValue(p->RChild);//returns the min value of the sub-tree starting at the right child node of p
...
int findLargest (ListNode *p)
// --------------------------------------------------------------------------
// Preconditions: list head pointer is passed as a parameter.
// Postconditions: returns the largest value in the linked list.
// --------------------------------------------------------------------------
{
if (p->item != NULL...
I'm doing a hw assignment and my professor uses this code to test our program:
int main()
{
const int SZ1 = 10;
const int SZ2 = 7;
const int SZ3 = 5;
float array1[SZ1];
float array2[SZ2];
float array3[SZ3];
DisplayValues(SortValues(GetValues(array1, SZ1), SZ1), SZ1);
DisplayValues(SortValues(GetValues(array2, SZ...
Lets say we create an object of class Student, we create two instances/objects class Student(i.e. StudentA and StudentB). We do shallow copy to initialize data members of B with that of A as follows:
Student StudentB = StudentA;
And then we destroy StudentB. Are we facing a situation of Dangling Pointer here? Why and how? Please explai...
Using pointer arithmetic, it's possible to assign characters from one array to another. My question is, how does one do it given arbitrary start and stop points?
int main(void)
{
char string1[] = "something"; //[s][o][m][e][t][h][i][n][g][\0]
int start = 2, count = 3;
char string2[10] = {0};
char *ptr1 = &string1[start];...
Hi, I have a programme in which I have written three functions, difference (that calculates the difference in numbers between arrays) sum (that totals the array up) and calculate difference which uses the difference function to determine what the next array should be).
All these functions are working but I'm having problems getting the...
The question is :
Use a while-loop to ask the user for a number between 1 and 10. While the user fails to enter a number between 1 and 10 (inclusive), ask them for another number.
My code so far is:
int i = 0;
Console.WriteLine("Enter a number.");
while (i <= 10)
{
Console.ReadLine();
if (i > 1 && i < 10)
{
Consol...
Possible duplicate: http://stackoverflow.com/questions/2301733
I need help with a problem.
Given a MxN board represented with M letters (a-z) in each of the N lines, i have to find the biggest area in which there are only 2 types of letters in it. The area must have rectangular shape. Here's an example :
4x4:
AAAA
ABBC
BBCA
DCAA
...
I am a student in college and have an assignment which requires finding large prime numbers. I was given the following "simple" algorithm by the professor to find 2 likely prime numbers.
generate random a and p where 1 < a < p
confirm that gcd(a,p) is = 1 -- this is suppose to remove Carmichael numbers Edit(meant equal to 1)
perform "m...
Hello,
I'm a programming student in my first C++ class, and recently we were given an assignment to implement a recursive program that finds the first occurrence of a given substring in a given string.
For example:
int StringIndex("Mississippi", "sip"); // this would return 6
The hint we are given is to use a recursive helper functi...
How do I read in a variable number of characters? The user can input a positive or negative number that is too big to be stored in an integer. I am then checking to make sure the char is a number and storing it in an array of ints (although that will probably be changed to a short since I only need to be able to store 0-9).
istream& op...
Say I have a text file that has multiple names and their corresponding birthdays such as:
john doe 2 34
lauren doe 3 4
albert r. grifton 03 12
The converter program will make usernames for the students such as:
jd0234
ld0304
arg0312
The problem I am experiencing is adding the zeros for the if/else conditions for the odd amounts o...
I am trying to print out an array of integers. I am getting a seg fault when I try to print as below. If I uncomment the "In for loop" it will print everything except the last item of the array and it still has a seg fault. When I uncomment both of the comments (or just the "done with for loop") everything prints fine. Why does this happ...