Sign In
Mark Schmidt's Abode
On Programming, Writing, Gaming, Fitness, Life
Translate This Page
Translate this page
Powered by
Microsoft® Translator
Options
Blog Home
Email Blog Author
Share this
RSS for posts
Atom
RSS for comments
Search
Advanced search options...
Search In:
Everything
Blogs
Forums
People
Groups
Places
Pages
Date range:
All Time
Last Year
Last 6 Months
Last 3 Months
Last Month
Last Week
Last Two Days
Tags
.NET
animation
Avalon
BizTalk Server
C/C++
Cool Stuff
Humor
Misc
Pages
RosettaNet Accelerator
Technical Writing
WF Designer Hosting
Windows Workflow Foundation
WPF
Xml
Xslt
Archive
Archives
April 2009
(1)
March 2009
(1)
June 2008
(1)
February 2008
(1)
January 2008
(1)
December 2007
(4)
November 2007
(5)
October 2007
(1)
September 2007
(4)
August 2007
(4)
July 2007
(4)
June 2007
(2)
March 2007
(2)
February 2007
(1)
January 2007
(2)
October 2006
(1)
September 2006
(2)
August 2006
(2)
June 2006
(2)
March 2006
(2)
January 2006
(1)
October 2005
(4)
September 2005
(7)
August 2005
(1)
April 2005
(1)
March 2005
(1)
December 2004
(1)
November 2004
(1)
October 2004
(3)
September 2004
(2)
August 2004
(4)
Follow up to interview question
MSDN Blogs
>
Mark Schmidt's Abode
>
Follow up to interview question
Follow up to interview question
Mark Schmidt-MSFT
7 Oct 2005 2:26 PM
Comments
6
My
first interview question
was pretty successful. The one that was closest to my solution was Paul Bartrum (that name sounds familiar for some reason) followed closely by domovoi (though I didn't test his). Both Paul and I had just a single for loop enumerating once over the collection. I used the concept of "period" which probably has some other name but that's the best description I could come up with. Basically, a period in this sense (and in my mind) is how long it takes a single dimension's index to change when the lower indices are enumerated. This is determined by multiplying the upper bounds of dimensions following that dimension. For example, if you had: int[,,] arr[3,2,3] the third dimension's period is 1 because no dimensions follow it. The second dimension's period is 3 and the 1st dimension's period is 6 (2 x 3). Once I conceptualized that, the rest was trivial. Paul was pretty much thinking along the same lines. There were some good solutions but due to time, I can't go through all of them (especially the python one which threw me for a loop hehe).
Now, here's the next interview question. I think this one will be a lot easier and it follows along the same line. Here goes.
Given a multidimensional array, set each value in that array as efficiently as possible. In other words, don't have a series of nested for loops. Let's say that I will just give you an array without any preconceived notion of how that array was constructed. Make sense? Then get to it!
6 Comments
Blog - Comment List MSDN TechNet
Comments
Loading...
Leave a Comment
Name
Comment
Please add 4 and 1 and type the answer here:
Post