找回密码
 立即注册
搜索
总共850条微博

动态微博

查看: 2278|回复: 7
打印 上一主题 下一主题
收起左侧

a Microsoft interview Question

[复制链接]
achen 该用户已被删除
跳转到指定楼层
楼主
发表于 2004-12-20 01:35:26 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

1

主题

10

帖子

97

积分

沙发
发表于 2004-12-20 11:21:03 | 只看该作者

回复:a Microsoft interview Question


降序冒泡算法
www.ddhw.com

 
回复 支持 反对

使用道具 举报

10

主题

271

帖子

1996

积分

板凳
发表于 2004-12-20 19:46:03 | 只看该作者

回复:a Microsoft interview Question


There is no guaranteed way to get the biggest diamond.  All we can do is to miximize the probability of getting it.  The overall strategy is to stopped and get the diamond which is the biggest so far.  For example, we stopped at the nth floor and observed that the diamond on that floor was the biggest so far (from floor 1 to floor n), then we simply took it and left the building.  A stochastic dynamic programming formulation will help us to determine the optimal strategy (the best stopping point), which in this case, is to skip (but check their sizes) the first 37% percent (or first 4 floors), then pick the one which is the biggest among the all the checked diamonds.
BTW, you can apply this method in dating girls/boys :-).
www.ddhw.com

 
回复 支持 反对

使用道具 举报

achen 该用户已被删除
地板
 楼主| 发表于 2004-12-21 03:04:35 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

10

主题

271

帖子

1996

积分

5#
发表于 2004-12-21 20:08:32 | 只看该作者

回复:can u explain it?


this is a sorting algorithm when you want to sort a list of elements in ascending or descending order.  it's not efficient in computational complexity.  it's not for this question either.
www.ddhw.com

 
回复 支持 反对

使用道具 举报

0

主题

25

帖子

150

积分

6#
发表于 2004-12-21 20:25:07 | 只看该作者

回复:回复:a Microsoft interview Question


I came across a similar problem before, the answer was after went through n floors (n=1/e * total number of floors), then take the first one that's bigger than those you have seen so far in the following floors.

In fact an Austrian mathematician (a woman) have applied this to dating and marriage. She claims that you should experience 12(?, I'm not 100% sure) lovers before commit youself to the next best. so she assumed the total number of lovers you would experience in your life is = 12*e = 33, which I think is quite a big number for average Chinese,... I see some cultural different here.

www.ddhw.com

 
回复 支持 反对

使用道具 举报

456

主题

1770

帖子

2万

积分

7#
发表于 2004-12-22 10:18:09 | 只看该作者

Very interesting. I guess she is still single[:D)]


  Very interesting. I guess she is still single




回复 支持 反对

使用道具 举报

0

主题

25

帖子

150

积分

8#
发表于 2004-12-23 00:38:17 | 只看该作者

That part I don't know, but she's pretty.[;)]


  That part I don't know, but she's pretty.




回复 支持 反对

使用道具 举报

24小时热帖
    一周热门
      原创摄影
        美食美文
          您需要登录后才可以回帖 登录 | 立即注册

          本版积分规则

          Archiver|手机版|珍珠湾ART

          Powered by Discuz! X3 © 2001-2013 All Rights Reserved