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;
相关阅读
let's guess which company...一道面试题问个h1b的问题求教:Lunch Interview 选什么店Ctrl+A, Ctrl+C, Ctrl+V这道题没怎么看懂有人做过video conference 面试么?面试结束了看来 amazon 电面放鸽子很常见阿请教一下opt 状态下做volunteer回国的问题被HR放鸽子了,真郁闷【讨论】什么样的工作才是最理想的工作?请教H1b transfer 问题拿到三个offer,却又不得不放弃relocation package?关于recruiter 发来的on-line assessment有个公司发onsite邀请后no email from recruiter for two days after Amazon onsite难道我下载到的是盗版CareerCup 150??PhD research assistant算employment history吗?这几天是怎么啦?