Homework Statement
Homework Equations
Chebyshev's Theorem: The percentage of observations that are within k standard deviations of the mean is at least
100(1 - (1/k2))%
Chebyshev's Theorem is applicable to ANY data set, whether skewed or symmetrical.
Empirical Rule: For a symmetrical...
Homework Statement
Wherein α, β are strings, λ = ∅ = empty string, βr is the shortest suffix of the string β, βl is the longest prefix of the string β, and T* is the set of all strings in the Alphabet T, |α| denotes the length of a string α, and the operator ⋅ (dot) denotes concatenation of...
Thanks! I must've mixed up the order of the steps while desperately trying to figure this out yesterday.
I've revised my inductive step to reflect that fact. Here's the new version:
LHS = |αn| = |αk + 1| = |(αk) ⋅ α| = |αk| + |α| = k|α| + |α| = (k+1)|α| = n|α| = RHS
Is this better? Also, is...
After a few hours of trying, I managed to make it through the synthetic method using induction on n and another proposition (I'll call it "Length of Concatenated Strings", that was proven in class:
So here's the base case:
I'll pause here to note that I'm not confident this is right; in...
Homework Statement
Wherein α is a string, λ = ∅ = the empty string, and T* is the set of all strings in the Alphabet T.
Homework Equations
(exp-Recursive-Clause 1) : α0 = λ
(exp-Recursive-Clause 2) : αn+1 = (αn) ⋅ α
The Attempt at a Solution
[/B]
This one is proving difficult for me. I...
Homework Statement
Assignment instructions are as follows:
For the purposes of this assignment, we've been provided with some skeleton code (the "myshell.c" program mentioned in the instructions). I'll post it here:
#include <stdio.h>
#include <sys/wait.h>
#include <unistd.h>
#include...
So I was reading through the implementation of the read/write methods given by my professor to see if maybe there was a clue there that could help me figure out how to do this. Here's the code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>...
Homework Statement
The assignment I'm doing involves manipulating an image stored in a 24-bit uncompressed BMP file. We were provided with two pre-written files (a header and a .c source file) that contain functions that read and write the image file, as well as a flip() function (mirrors the...
I suspected as much! I changed the line strcpy(fileDirectory, argv[optind] to
if (argv[optind] != NULL)
{
strcpy(fileDirectory, argv[optind]
}
That fixed everything right up. Knowing that argv[optind] is NULL in cases like this will come in handy in the future. Thanks!
I put some thought into this. Checking a few different documentation sources for the getopt() function, I eventually found something that looked interesting:
https://linux.die.net/man/3/optind
So if filename doesn't exist, optind would point to the first argv element that isn't an option...
Homework Statement
Write a C program to run on ocelot to find the total count of words and optionally the longest and or shortest words in a string input by the user or coming from a file. If there is no filename the user would be prompted to enter the string. You must use getopt to parse the...
Homework Statement
So basically, I have to implement the algorithm given in the relevant equations section.
Homework Equations
The Attempt at a Solution
First and foremost, my code. Some bits that weren't directly relevant to the problem I'm having were removed for readability's sake...
You're absolutely right, but since the LC-3 sign-extends its 9-bit PC-offset values to 16 bits, using (for example) 1 1111 1111 as the offset would actually yield
b1111 1111 1111 1111 = xFFFF
Rather than b0000 0001 1111 1111 = x01FF = d511.
That's why I couldn't use
b0000 01000 1000 1101 =...
Homework Statement
I'm writing a program in binary on the LC-3. The program counts the occurrences of a specific character in a file. Relevant excerpts from the assignment instructions:
1) Download the source code for Figure 5.17 from the textbook webpage as code1.bin.
Code x3000 as the...
You're absolutely right. Thanks so much for pointing that out. I hadn't realized that I had been overwriting firstLink and lastLink repeatedly rather than actually inserting "between" them by using their next and previous pointers. As soon as I sorted that out, things got better. That's what I...