Possible Duplicate:

I tried to post a question as following:

Just wondering in C#, if I get the length of an array by array.Length, what's the time complication? Is it O(1) or O(n?

It says "It does not meet our quality standards." Can anybody explain what the problem is here?

share|improve this question
@PopularDemand You rejected that edit while I was improving it, and now my edit summary makes me look insane –  Michael Mrozek Oct 26 '11 at 18:38
@Jim, I rejected your edit because you fixed the text inside the blockquote. Since this question is about a rejected post, it could have been the cause of the error, and so shouldn't be touched. –  Pops Oct 26 '11 at 18:38
Oh, sorry, @MichaelMrozek. Wait, Michael Mrozek? Never mind, not sorry. –  Pops Oct 26 '11 at 18:39
its O(1). Any language that has an O(n) algorithm for determining the length of an array should be shot. –  Won't Oct 26 '11 at 19:03
add comment

marked as duplicate by Michael Mrozek, Pops, kiamlaluno, Lance Roberts, jonsca Oct 26 '11 at 20:49


2 Answers

Your question is too short and the answer is O(1).

share|improve this answer
Thanks. Looks like Stack Overflow is not a place to answer short questions. May I ask why it's O(1) or where I can find how array.Length work? –  truelies Oct 26 '11 at 18:20
@truelies - Ah now you see why short posts are bad :D -- It is O(1) because it just needs to look at a property and does not need to iterate over the list. You can see this in the debugger and with knowledge of standard patterns for implementing arrays. (That is, you can put a marker at the end or store the size in the object.) –  Hogan Oct 26 '11 at 18:49
add comment

"Just wondering" might be a problem in addition to what Hogan says. Just ask the question straight up :)

share|improve this answer
But it didn't say what's the problem was. I will remove it and see if I can post. –  truelies Oct 26 '11 at 18:22
Just removed "Just Wondering" Still got Oops! Your question couldn't be submitted because: It does not meet our quality standards. –  truelies Oct 26 '11 at 18:23
Seems it has too much limitation. –  truelies Oct 26 '11 at 18:24
add comment

Not the answer you're looking for? Browse other questions tagged .