I meant
4 is at location image1[0][1]
4 is the value.
so,
top = 1;
bottom = 2;
left = 1;
Type: Posts; User: IAmHere
I meant
4 is at location image1[0][1]
4 is the value.
so,
top = 1;
bottom = 2;
left = 1;
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
1 is (0,0)
2 is (1,0)
3 is (2, 0)
4 is (0, 1)
.
.
Sorry for the confusion.
The first 2d array is:
int[][] image1 = { {1, 2, 3},
{4, 5, 6},
{7, 8, 9}, };
The second 2d array is:
top = 1;
bottom = 2;
left = 1;
(top, left) is the coordinates for the top left corner of the 2d array.
(bottom,right) is the coordinates for the bottom right corner of the 2d array.
So, we have 4 variables.
...
Given a 2d array
and
4 variables that creates another 2d array.
(top, left) and (bottom,right)
(Those are the coordinates to form another 2d array.)
These variables can partially cover the...
How do I calculate the mean?
The answer for this case is 7.
Why?
My assignment is here(if you want to know the question but I don't think you need it to answer "my" question):...
So, a "sub-region of the image" is a rectangle. So, how do I compute the average of a rectangle?
This is my assignment:
http://www.cse.yorku.ca/course/2011/assignments/assignment%201/Q2/Q2.html
I have no idea what is an image value. I tired looking it up but there's no help.
All the codes...
Sorry, I just posted a question under a section and I notice there is a better section for my type of question.
So, I posted a question twice...
eek...
I don't understand the palindrome word a(b^n)a.
Based on the pumping lemma definition:
The pumping states that: |word| >=n
and
The length of this word is (1 + n + 1) which is...
I think he is asking us to find a relation with those numbers and to print those numbers using a nested for loop.
=)
if t.hasALeft(v) then
{
left = t.left(v)
}
return weight(t, left) + weight(t, right)
if t.hasARight(v) then
{
right = t.Right(v)
I figured it out.
static boolean method (BinaryTree t)
{
...
return method2(t, t.root());
}
I'm not sure how to write a recursive method with a tree as a parameter.
I'm guessing you have to call its subtree every time.
In my book, I'm given BinaryTree t and Node v as my parameter. So, I can traverse the tree by doing like:
static boolean add(BinaryTree t, Node v )
return add(t, t.left(v)) + add(t,...
Ok. =)
I usually ask people if I'm on the right track. So, I guess it's ok to ask them to have a quick check on my work.
I'll try to post more detailed questions and posts.
Thanks for your tips.
I think you're right.
So, I changed my code so that the base case meets your requirement.
So my code right???
// returns the weight of node v
static int weight(BinaryTree t, Node v)
if...
I was about to do it your way, but I notice that in my book, there's no method t.hasRight(v) and t.right(v) . It only checks for the left children.
So, I guess I have to stick to my original code.
...
Hi, I'm new here.
I found the reply for my posted question to be slow. If I'm stuck on something, I have to wait a day until I get a reply.
My suggestion is to make a chatbox on this forum, so...
I'm suppose to add up all the number that are in a node of a binary tree.
Is this correct???
This is just the algorithm:::
static int weight(BinaryTree t, Node v)
if t.size == 0 then //if...
public static int f(int a, int b)
{
Z.h1(a, b); //// arbitrary code
if (Z.h2(a, b))
return Z.h3(a, b);
else
{
...