I have a homework problem for my algorithms class asking me to calculate the maximum size of a problem that can be solved in a given number of operations using an O(n log n) algorithm (ie: n log n = c). I was able to get an answer by approximating, but is there a clean way to get an exact answer?
...
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnCalculate_Click(object sender, EventArgs e)
{
decimal decPossible;
decimal finalPoints;
decPossible = decimal.Parse(txtPossible.Text);
//Get value from achieved textbox
final...
Hello. For a homework assignment i need to program the following scenario. This is going to be done using semaphores using BACI (which is C--)
There are 2 unisex restrooms that can hold 4 people each. Since it is unisex only people of the same sex can be in the restroom at the same time and FIFO is not important. I have the basic "al...
I am trying to do a search and replace with variables. In this case variables that I pulled from a previous match. Here is my code:
$fileContentToAlter =~ s/$2/$1/g;
Now I realize in that state, it is being read incorrectly as $ has its own meaning inside of a regexp. I did some searching on the web and read that doublequotes could fi...
I'm trying to write my own Mergesort function in the same fashion as C's qsort function. If I were writing MergeSort for an array of known items, I wouldn't have a problem, but since I don't know what they'll be it's throwing me for a loop.
The specification given by my professor didn't want me to use a separate function for merging, so...
I have this programming assignment that converts between meters and feet, and between kilograms and pounds. When I tell the program I want to convert weight (by entering "w" when prompted), it gives me my "Error: Too many input characters, ". error. I worked on this for a long time, but can't figure it out. Can someone please tell me ...
I have to design GUI for authentication. Which will have
1. User name
2. Password
using The stream socket, The packet socket or The raw packet in php and mysql language. any references or tutorials?
...
In my program I need to update the Balance column of the text file each time the user does a withdrawal. I used both the write methods as well as the append methods, but to no avail.
Once the user has logged in, that particular line is stored in the array
#PIN AccountNo Balance
1598 01-10-102203-0 95000
4895 01-10-102248-0 45000
9512 0...
Two people considered identical if they have exactly the same information (same name, sex, birth and death).
I must declare a function pers: person * person -> bool that determines whether two values of type person enter the same person.
I'm stucked, anyone ? tnx.
...
public class Student implements java.io.Serializable {
private long studentId;
private String studentName;
private Set<Course> courses = new HashSet<Course>(0);
public Student() {
}
public Student(String studentName) {
this.studentName = studentName;
}
public Student(String studentName, Set<Course> courses) {
this.studentName...
Hello. I am writing a program (for homework) that simulates a unisex bathroom. Only 4 people are allowed at a time and men and woman cannot enter if the other sex is already using the bathroom. My problem is with allowing a max of 4 people in the bathroom. As you can see from the output, only 1 person is getting into the restroom at ...
So for an assignment I have to make a programm that asks for a input of a string and then detects palindromes.
thing is, also numbers can be put in. When more than half of the input of the string is a number it needs to regard the string as a numeric string and disregard the other symbols.
So what i thought is to put the input string ...
I'm taking in a float as input, and then outputting its equivalent representation in base 2 scientific notation. This is in IEEE 32 bits with: 31 sign bit, 23-30 exponent (with 127 offset), 0-22 mantissa (with implicit leading 1).
One of the conditions which I'm not exactly sure the meaning of is "Your mantissa should have the implicit ...
I have to do this for an assignment in my java class. I have been searching for a while now, but only find solutions with regex etc.
For my assignment however I may only use charAt(), length() and/or toCharArray(). I need to get from a string like gu578si300 for example just the numbers so it will become: 578300.
i know numbers are 48...
I am having an issue solving Bracket Checker .
i cant seem to solve the problem if user input this sequence of bracket then my program must print its not a right sequence
Input:
({}[)
Output:
Not a Right Sequence
My code is below
Stack s = new Stack();
Queue q = new Queue();
bool isok = true;
st...
void func( int *p)
{
// Add code to print MEMORY SIZE which is pointed by pointer P.
}
int main()
{
int *p = (int *) malloc (10);
func(p);
}
How can we find MEMORY SIZE from memory pointer P in func() ?
...
Hello, I am a fairly decent programmer, but I suck at math. I need help understanding this problem so i can write a program to solve it. I dont really understand the formula.
https://cs.harding.edu/easel/cgi-bin/view?id=4896
...
In my data structures course, we are creating a basic vector class. In my header, there is a member function for inserting new values into the vector. If the capacity of my vector is big enough for the insertion of one value, the program runs fine. However, if the vector needs to grow, I run into pointer errors. After hours of trying to ...
Hi,
How would I check for descending digits in an integer? For instance, if the user entered 98765, I would need to verify this and say the digits are descending and vice versa. I cannot convert the integer to a string, and there is no limit on the length. Oh, the numbers have to be >= 0.
I know I need to split the integer up, but I...
How do I kill a windows form application other than clicking the x button. More specifically, I need to close the program from a menu option. I am coding this in c# 2010.
...