由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
CS版 - CS Algo Question
相关主题
求助:关于2个python的题目本科菜鸟关于research方向的问题
ACM Programming Contest: From NYTimeswho will go to algo 2005?
突发奇想Attending Algo 2005 and sharing double rooms
(2004)美国名校计算机科学系大陆教授 (updated)How can we get financial supports or donations for a conference?
C++用哪个编译器?排序算法计算量问题! (转载)
赫赫,有没有人icpc总决赛。。。一道graph的问题求教!(from MIT Intro to Algo)
CS PHD 好program 那些招生不注重gpa的[合集] 读计算机两年博士毕业需不需要拖到三年?
ICPC结果出来了CS master选课咨询
相关话题的讨论汇总
话题: array话题: function话题: 110001100话题: column话题: sub
进入CS版参与讨论
1 (共1页)
l***t
发帖数: 81
1
1. Create a function findZeroArraySize() that takes a 2-dimensions int array
, its width and its height as arguments. The array is filled with 0 and 1. T
he function returns the size (in int) of the biggest 2-dimensions sub-array
filled only with 0. This function should be as fast as possible.
Ex:
If argument is , function returns 9.
001011110
110001100
010000011
110001100
111011100
Thanks a lot.
c********y
发帖数: 13
2
return 3吧?

【在 l***t 的大作中提到】
: 1. Create a function findZeroArraySize() that takes a 2-dimensions int array
: , its width and its height as arguments. The array is filled with 0 and 1. T
: he function returns the size (in int) of the biggest 2-dimensions sub-array
: filled only with 0. This function should be as fast as possible.
: Ex:
: If argument is , function returns 9.
: 001011110
: 110001100
: 010000011
: 110001100

z*****n
发帖数: 7639
3
I guess so.

【在 c********y 的大作中提到】
: return 3吧?
l***t
发帖数: 81
4
No, it is 9.
the largest 0 sub matrix has 9 zeros :
000
000
000

【在 z*****n 的大作中提到】
: I guess so.
z*****n
发帖数: 7639
5
hehe, got it.

【在 l***t 的大作中提到】
: No, it is 9.
: the largest 0 sub matrix has 9 zeros :
: 000
: 000
: 000

s******e
发帖数: 92
6
I think I have an algorithm in mind. Suppose the size of the original matrix
is a * b. The complexity of my algorithm is O(ab). Not very fast ...

【在 l***t 的大作中提到】
: 1. Create a function findZeroArraySize() that takes a 2-dimensions int array
: , its width and its height as arguments. The array is filled with 0 and 1. T
: he function returns the size (in int) of the biggest 2-dimensions sub-array
: filled only with 0. This function should be as fast as possible.
: Ex:
: If argument is , function returns 9.
: 001011110
: 110001100
: 010000011
: 110001100

a******t
发帖数: 100
7

There are a*b elements in the matrix. You have to access each at least once.
If your algorithm is O(ab), it is pretty fast, I think.

【在 s******e 的大作中提到】
: I think I have an algorithm in mind. Suppose the size of the original matrix
: is a * b. The complexity of my algorithm is O(ab). Not very fast ...

g******a
发帖数: 730
8
当年我们的算法作业题啊

【在 s******e 的大作中提到】
: I think I have an algorithm in mind. Suppose the size of the original matrix
: is a * b. The complexity of my algorithm is O(ab). Not very fast ...

m****h
发帖数: 261
9
I think it can be solved by scanning the matrix column by column while
maintaning a measure, say, T(i), which is the maximum all 0 sub matirx before
scanning to column i, and then update T(i). The complexity should be
O(ab).

array
T
sub-array

【在 s******e 的大作中提到】
: I think I have an algorithm in mind. Suppose the size of the original matrix
: is a * b. The complexity of my algorithm is O(ab). Not very fast ...

a******t
发帖数: 100
10

How can you gaurantee the solution in T(i) is the largest?
1111001111
1110000111
1100000011
1000000001
0000000000
1000000001
.......

【在 m****h 的大作中提到】
: I think it can be solved by scanning the matrix column by column while
: maintaning a measure, say, T(i), which is the maximum all 0 sub matirx before
: scanning to column i, and then update T(i). The complexity should be
: O(ab).
:
: array
: T
: sub-array

相关主题
赫赫,有没有人icpc总决赛。。。本科菜鸟关于research方向的问题
CS PHD 好program 那些招生不注重gpa的who will go to algo 2005?
ICPC结果出来了Attending Algo 2005 and sharing double rooms
进入CS版参与讨论
s*****v
发帖数: 360
11
O(n*n*n)
a******t
发帖数: 100
12
Where did you find these problems? homework?
These problems are listed at
http://trikuare.cx/mt/archives/000718.php

【在 l***t 的大作中提到】
: 1. Create a function findZeroArraySize() that takes a 2-dimensions int array
: , its width and its height as arguments. The array is filled with 0 and 1. T
: he function returns the size (in int) of the biggest 2-dimensions sub-array
: filled only with 0. This function should be as fast as possible.
: Ex:
: If argument is , function returns 9.
: 001011110
: 110001100
: 010000011
: 110001100

m****h
发帖数: 261
13
It's like induction. It is simple when scanning the first column. Then, in the
folowing steps, we need only check the new column, to see if T(i) can be made
any larger.

before
matrix

【在 a******t 的大作中提到】
: Where did you find these problems? homework?
: These problems are listed at
: http://trikuare.cx/mt/archives/000718.php

S*******t
发帖数: 97
14
i think these are all basic programming problems
once i was participating ACM/ICPC, i could solve
these 3 problem in 5 min

【在 a******t 的大作中提到】
: Where did you find these problems? homework?
: These problems are listed at
: http://trikuare.cx/mt/archives/000718.php

a******t
发帖数: 100
15
If these are homework problems, the instructor is too lazy. That's the point.

【在 S*******t 的大作中提到】
: i think these are all basic programming problems
: once i was participating ACM/ICPC, i could solve
: these 3 problem in 5 min

S*******t
发帖数: 97
16
re
but maybe that guy is just interested in programming, hehe

【在 a******t 的大作中提到】
: If these are homework problems, the instructor is too lazy. That's the point.
1 (共1页)
进入CS版参与讨论
相关主题
CS master选课咨询C++用哪个编译器?
算法学的很痛苦,求建议赫赫,有没有人icpc总决赛。。。
有没有去 algo 2009 开会CS PHD 好program 那些招生不注重gpa的
计算机哪个方向越老越值钱?ICPC结果出来了
求助:关于2个python的题目本科菜鸟关于research方向的问题
ACM Programming Contest: From NYTimeswho will go to algo 2005?
突发奇想Attending Algo 2005 and sharing double rooms
(2004)美国名校计算机科学系大陆教授 (updated)How can we get financial supports or donations for a conference?
相关话题的讨论汇总
话题: array话题: function话题: 110001100话题: column话题: sub