Search:

Type: Posts; User: IAmHere

1. Thread: A 2d array problem

by IAmHere
Replies
10
Views
1,605

Re: A 2d array problem

I meant
4 is at location image1[0][1]
4 is the value.

so,

top = 1;
bottom = 2;
left = 1;

by IAmHere
Replies
10
Views
1,605

{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)
.
.
3. Thread: A 2d array problem

by IAmHere
Replies
10
Views
1,605

Re: A 2d array problem

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;
4. Thread: A 2d array problem

by IAmHere
Replies
10
Views
1,605

Re: A 2d array problem

(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.
...
5. Thread: A 2d array problem

by IAmHere
Replies
10
Views
1,605

A 2d array problem

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...
6. Thread: How come the mean is 7?

by IAmHere
Replies
1
Views
673

How come the mean is 7?

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):...
7. Thread: Compute the average image value

by IAmHere
Replies
3
Views
1,111

Re: Compute the average image value

So, a "sub-region of the image" is a rectangle. So, how do I compute the average of a rectangle?
8. Thread: Compute the average image value

by IAmHere
Replies
3
Views
1,111

Compute the average image value

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...

by IAmHere
Replies
6
Views
809

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...
10. Thread: A Simple Pumping Lemma Question.

by IAmHere
Replies
0
Views
805

A Simple Pumping Lemma Question.

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...
11. Thread: plz help me with this program.....i would be highly...obliged if i'm helped

by IAmHere
Replies
8
Views
1,047

Re: plz help me with this program.....i would be highly...obliged if i'm helped

I think he is asking us to find a relation with those numbers and to print those numbers using a nested for loop.

=)
12. Thread: Java Binary Tree (Beginners)?

by IAmHere
Replies
6
Views
2,728

Re: Java Binary Tree (Beginners)?

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)

by IAmHere
Replies
3
Views
1,471

[SOLVED] Re: Traversing a tree

I figured it out.

static boolean method (BinaryTree t)
{
...
return method2(t, t.root());
}

by IAmHere
Replies
3
Views
1,471

[SOLVED] Re: Traversing a tree

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.

by IAmHere
Replies
3
Views
1,471

[SOLVED] Traversing a Tree (Beginners)

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 )

by IAmHere
Replies
6
Views
809

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.
17. Thread: Java Binary Tree (Beginners)?

by IAmHere
Replies
6
Views
2,728

Re: Java Binary Tree (Beginners)?

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...
18. Thread: Java Binary Tree (Beginners)?

by IAmHere
Replies
6
Views
2,728

Re: Java Binary Tree (Beginners)?

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.
...

by IAmHere
Replies
6
Views
809

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...
20. Thread: Java Binary Tree (Beginners)?

by IAmHere
Replies
6
Views
2,728

Java Binary Tree (Beginners)?

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...
21. Thread: Convert this to non-recursive

by IAmHere
Replies
1
Views
1,492

Convert this to non-recursive

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
{
...
Results 1 to 21 of 22