avatar
a*r
1
我记得原来NND?贴过不错的电梯设计,找不到link了。
哪位有保存的? 能不能share一下?
多谢!
avatar
d*e
2
应该是比较旧的贴所以都删了.没找到电梯题,我记得当时他应该是说停车场的,在未名
观察里找到,看21楼.
http://www.weiming.info/zhuti/JobHunting/31956527/

【在 a***r 的大作中提到】
: 我记得原来NND?贴过不错的电梯设计,找不到link了。
: 哪位有保存的? 能不能share一下?
: 多谢!

avatar
p*2
3
电题这题谁能给个标准解?design就可以了。不需要code。
avatar
p*2
4

大牛能不能讲讲电题的题目应该怎么做呢?我正好想学习一下了。

【在 d**e 的大作中提到】
: 应该是比较旧的贴所以都删了.没找到电梯题,我记得当时他应该是说停车场的,在未名
: 观察里找到,看21楼.
: http://www.weiming.info/zhuti/JobHunting/31956527/

avatar
p*p
5
贴个我以前写的,仅供参考,肯定不是标准解
包括控制系统和电梯厢两个类
class ElevatorSystem
{
public:
struct SystemSetup{
int totalFloors;
int totalElevators;
};
ElevatorSystem(SystemSetup &);
~ElevatorSystem(void);
void requestUp(int floor);
void requestDown(int floor);
private:
int totalFloors;
int totalElevators;
Elevator **elevators;
enum RequestType {NONE, UP, DOWN};
RequestType *requests;
void resetRequest(int floor);
};
class Elevator
{
public:
Elevator(int id, int totalFloors);
~Elevator(void);
enum ElevatorStatus {RUNNING, IDLE, STOPPED};
enum RunningStatus {UP, DOWN, STAND};
ElevatorStatus elevatorStatus;
RunningStatus runningStatus;
void stop();
int currentFloor;
int *stopRequestList; // one stop request slot on each floor
queue destinationList;

private:
int id;
int totalFloors;
int currentPassengers;
};

【在 p*****2 的大作中提到】
: 电题这题谁能给个标准解?design就可以了。不需要code。
avatar
c*a
6
我有本面试算法书..里面的电梯design有3,4页A4...
avatar
r*6
7
哪本书里的,现在感觉design是薄弱环节

【在 c*****a 的大作中提到】
: 我有本面试算法书..里面的电梯design有3,4页A4...
avatar
c*a
8

烙印的书
coding interview questions
挺多bug的,不过题目解答很详细
里面的dp,数据架构章很不错

【在 r*******6 的大作中提到】
: 哪本书里的,现在感觉design是薄弱环节
avatar
a*r
9
设计题真是比较难搞,不但要不犯错误,
还要刚好让人家喜欢,真是。。。。
我有一次被人说interface设计不好,但是其实觉得是他的设计不好,这还算好的,好
歹和我讨论他的设计。碰上不说的,死都不知道哪里死。
本来一件事就有很多种搞法。
avatar
p*2
10

说的很好。我就是这个意思。

【在 a***r 的大作中提到】
: 设计题真是比较难搞,不但要不犯错误,
: 还要刚好让人家喜欢,真是。。。。
: 我有一次被人说interface设计不好,但是其实觉得是他的设计不好,这还算好的,好
: 歹和我讨论他的设计。碰上不说的,死都不知道哪里死。
: 本来一件事就有很多种搞法。

avatar
p*2
11

多谢。有没有A家的OO大牛给指点一下?
queue destinationList;为什么要用queue呢?

【在 p*****p 的大作中提到】
: 贴个我以前写的,仅供参考,肯定不是标准解
: 包括控制系统和电梯厢两个类
: class ElevatorSystem
: {
: public:
: struct SystemSetup{
: int totalFloors;
: int totalElevators;
: };
: ElevatorSystem(SystemSetup &);

avatar
p*2
12

能不能给个summary?

【在 c*****a 的大作中提到】
: 我有本面试算法书..里面的电梯design有3,4页A4...
avatar
c*a
13

把照片用ocr拷了前面几段话
Design an elevator system at a shopping complex using java threads to
support multithreading.
Solution: Let us understand the scenarios which need to be considered while
designing an elevator system. Shoppers arrive in the building at random
times. During the time a shopper is in the building he may request elevator
service from the floor where he is currently located. The request always
specifies a direction, up or down. Shoppers on the lowest floor may only
request up service; those on the top floor may only request down service;
all others may request either service.
On entering an elevator a shopper selects a destination floor. The elevator
then closes its doors and moves to that destination floor, possibly stopping
on intermediate floors to deliver other shoppers who may have selected
intermediate floors. When an elevator arrives at a destination floor it
stops, opens its doors, and discharges any shoppers who have selected that
floor. Having stopped, opened its doors and unloaded its passengers, the
elevator then admits any shoppers who may be waiting for service in the
direction the elevator may be currently moving, subject to the restriction
that the elevator may not exceed its capacity to carry passengers. Shoppers
who do not succeed in boarding the elevator because it is full must make a
fresh request to obtain service at the floor on which they are waiting.
For our implementation, we can assume that the elevator moves passengers
from floor to floor in simulation. The basic objects of the system are:
Elevator, Person, Building and the Simulator which controls the elevators.
Elevator class keeps track of current state of it (whether it is moving up
or down), its capacity, set-vice time required at each floor and time
required to move to next floor, current number of passengers on elevator,
number of passengers getting off at each floor while moving etc...
Operations on Elevator object are synchronized to make the system thread
safe.

【在 p*****2 的大作中提到】
:
: 能不能给个summary?

avatar
p*2
14

while
elevator
多谢。感觉一个好的设计不容易。我觉得最终的算法不是面试那么点时间就能搞定的。
就算是OO设计,如果没有个大概的算法的话,也不好合理设计相互的关系。有没有大牛
说说面试这题的主要考点是什么?

【在 c*****a 的大作中提到】
:
: 把照片用ocr拷了前面几段话
: Design an elevator system at a shopping complex using java threads to
: support multithreading.
: Solution: Let us understand the scenarios which need to be considered while
: designing an elevator system. Shoppers arrive in the building at random
: times. During the time a shopper is in the building he may request elevator
: service from the floor where he is currently located. The request always
: specifies a direction, up or down. Shoppers on the lowest floor may only
: request up service; those on the top floor may only request down service;

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。