I need to find the largest square of 1's in a giant file full of 1's and 0's. I know i have to use dynamic programming. I am storing it in a 2D array. Any help with the algorithm to find the largest square would be great, thanks!
ex)
1 0 1 0 1 0
1 0 1 1 1 1
0 1 1 1 1 1
0 0 1 1 1 1
1 1 1 1 1 1
ans:
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
...
I am trying to write a method that uses recursion to compare the strings str1 and str2 and determine which of them comes first alphabetically (i.e., according to the ordering used for words in a dictionary).
If str1 comes first alphabetically, the method should return the integer 1.
If str2 comes first alphabetically, the method shoul...
The Fibonacci series is given as follow:
1, 2, 3, 5, 8, 13, 21, ...
How can I write a script file to calculate and print out the n-th Fibonacci term for n>2, where n is input by the user.
This is what I've tried:
n=input('n: ');
while(n < 3)
disp('must enter number >= 3')
if(n < 3)
fprintf('\n\n P...
I want to divide p(x) by q(x) given that:
p(x)=-5x^4+3x^2-6x
q(x)=x^2+1
I tried:
p=inline('-5*(x^4)+3*(x^2)','x')
p =
Inline function:
p(x) = -5*(x^4)+3*(x^2)
q=inline('x^2+1','x')
q =
Inline function:
q(x) = x^2+1
deconv(p,q)
but got error:
??? Undefined function or method 'filter' for input arguments of t...
Stuck on an array sorter. Have to sort numbers from largest to smallest. I'm trying two loops (one nested in the other). Here's the code:
int counter=0; // inner counter
int counter2=0; // outer counter
int sparky[14]; //array set to 14 just to simplify things
int holder; // holds the highest value
int high; //stores the position where ...
I have a simple problem that says:
A password for xyz corporation is supposed to be 6 characters long and made up of a combination of letters and digits. Write a program fragment to read in a string and print out a message as to whether or not the string entered would be considered a valid password.
I need help on completing this code....
Hello,
I've been asked to create a simple loop in assembly language but I am having trouble as the loop doesn't end when it should, it continues in an infinite loop.
I need to give the ECX a variable which is taken by input, but in my code below even when I specify the counter directly is still falls into an infinite loop.
My code is ...
I am creating a short c# console program that will ask 10 addition questions using random numbers from 0-10. Then it tells the user how many correct or incorrect. I am trying to find a way to validate that my user input is a number and not a letter. I am posting the code I have created so far, but could use some help.
using System;
u...
I'm trying to learn Ada for a course at the University, and I'm having a lot of problems wrapping my head around some of the ideas in it.
My current stumbling block: Let's say I have a function which takes a Matrix (just a 2-dimensional array of Integers), and returns a new, smaller matrix (strips out the first row and first column).
I...
What is the best algorithm to sort a link list [in C/C++]?
...
I have created the output for a program that allows a user to input their employee name and number and then their hourly wage and their total number of regular hours and overtime hours. This is my first time working with this type of program in java and I'm having an issue with the Try-Catch block where it gets the text input from the us...
A group diary and time management system is intended to support the timetabling of
meetings and appointments across a group of coworkers. When an appointment is to be
made that involves a number of people, the system finds a common slot in each of their
diaries and arranges the appointment for that time. If no common slots are available,...
How can I represent the following situation in Use Case diagram:
User can manage account settings:
change password, change language, date
of birth, etc.
I want to group "change password, change language, date of birth, etc." use cases in the "manage account settings" use case. What relation should be used here?
...
Hi i am trying to set up an RSA cryptosystem i have all the values except d selected prime numbers: p=1889, q=2003 n=3783667 phi=3779776 e= 61
i got stuck finding d could anyone help me to figure it out?
Setting up an RSA cryptosystem
• Two large distinct prime numbers p and q are selected, and n = pq and Φ(n) = (p − 1)(q − 1) are cal...
Could somebody please provide a step-through approach to solving the following problem using the Banker's Algorithm? How do I determine whether a "safe-state" exists? What is meant when a process can "run to completion"?
In this example, I have four processes and 10 instances of the same resource.
Resources Allocated | Resour...
int i = 0;
int min = x[i];
while ( i < n ){
if ( x[i] < min ){
min = x[i];
}
i++;
}
return min;
I've written the iterative form to find the min number of an array. But I'd like to write a function that with recursion. Please help!
...
I'm trying to get a basic DataGridView to insert new rows into a table. The table has an auto incrementing primary key (Identity 1,1) I'm having two problems with this.
The first problem is the DataSet which the DataGridView is populated from complains with the the primary key in the row is null. (I hide the primary key field from the ...
This is for homework! But I need help anyway. The assignment is to input a sentence then output the number of words, and the number of occurrences of each letter. The output must have the letters in alphabetical order. So far, I've been able to count the number of words and get all the letters to lower case so that I'll be able to keep c...
I have these 3 tables:
EMPLOYEES
Emp_id PK || First_Name || Last_Name || Hiring_Date
Department
Dep_Name || emp_id
SALARIES
salary || emp_id
Two months ago, the company hired new employees.
I need to write a SQL statement, that counts how many employees were hired. In the SAME statement, I need to find out, what are the finan...
Hi. I am trying to make a merge sort method, but it keeps on giving the wrong sorts. Where do I have change to make it actually sort the array? What part of the code has to be different? Thank you for your time.
public static void mergeSort(int[] array, int left, int lHigh, int right, int rHigh) {
int elements = (rHigh - l...