d*e
2 楼
应该是比较旧的贴所以都删了.没找到电梯题,我记得当时他应该是说停车场的,在未名
观察里找到,看21楼.
http://www.weiming.info/zhuti/JobHunting/31956527/
【在 a***r 的大作中提到】
: 我记得原来NND?贴过不错的电梯设计,找不到link了。
: 哪位有保存的? 能不能share一下?
: 多谢!
观察里找到,看21楼.
http://www.weiming.info/zhuti/JobHunting/31956527/
【在 a***r 的大作中提到】
: 我记得原来NND?贴过不错的电梯设计,找不到link了。
: 哪位有保存的? 能不能share一下?
: 多谢!
p*2
3 楼
电题这题谁能给个标准解?design就可以了。不需要code。
p*2
4 楼
大牛能不能讲讲电题的题目应该怎么做呢?我正好想学习一下了。
【在 d**e 的大作中提到】
: 应该是比较旧的贴所以都删了.没找到电梯题,我记得当时他应该是说停车场的,在未名
: 观察里找到,看21楼.
: http://www.weiming.info/zhuti/JobHunting/31956527/
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。
包括控制系统和电梯厢两个类
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
private:
int id;
int totalFloors;
int currentPassengers;
};
【在 p*****2 的大作中提到】
: 电题这题谁能给个标准解?design就可以了。不需要code。
c*a
6 楼
我有本面试算法书..里面的电梯design有3,4页A4...
a*r
9 楼
设计题真是比较难搞,不但要不犯错误,
还要刚好让人家喜欢,真是。。。。
我有一次被人说interface设计不好,但是其实觉得是他的设计不好,这还算好的,好
歹和我讨论他的设计。碰上不说的,死都不知道哪里死。
本来一件事就有很多种搞法。
还要刚好让人家喜欢,真是。。。。
我有一次被人说interface设计不好,但是其实觉得是他的设计不好,这还算好的,好
歹和我讨论他的设计。碰上不说的,死都不知道哪里死。
本来一件事就有很多种搞法。
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?
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;
相关阅读
贴几个job opening (转载)没人讨论这个稳拿吗?诚招手机网络游戏研发人员家长应知道的心理学规律 (转载)[合集] CS不是神,别把你这辈子都献给编程。(长)骑驴找马,驴不好骑啊攒rp,分享一下个人总结的Yelp HR小问题生物逃兵谈为什么CS容易一刀题油工到底是干什么的?面试完,要给HM 写感谢信吗[合集] MD收入是CS几倍,居然还有人说CS是神专业?求推荐弯曲intern或volunteer职位,ee方向[合集] CS只不过是武器:读《CS不是神,别把你这辈子都献给编程》[合集] 转行CS要慎重转CS根本不需要什么慎重说一下我最近面过的题吧面试中最悲惨的就是我儿子选了CS专业EE想在华盛顿DC找,可行吗?