Cisco Systems Interview Question


Country: India
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
2
of 2 vote

I would use... wait. What are the scenarios?

- Anonymous December 22, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
2
of 2 vote

First i would think of what operation will be done in a car parking:
--- add a car in the first empty parking space
--- delete a car from a given index in the parking lot
--- check if there are any empty spaces available


I would use a hasmap to map the parking spot to the car parked on it.
I would use another hashmap to keep track of te empty slots in order.

- Kamy December 25, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Car Parking is constant in Space. A Car comes and you part it. It goes and its place is taken by another car. There is no such thing as shuffling or FIFO so the answer should be Array. Design Pattern ??

- Abhi January 29, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

Hashtable would be better compared to heap. heap gives the max or min in O(1) time, but wat abt cars in the middle of the heap ?

- John December 23, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

This does not make any sense for me. The heap allows to get the smallest or the biggest element in constant time after the heap is created in linear time... but when a new car comes we have to rearrange the heap it depens from the value... I do not know but to represent parking I thin the best would be just an array of spaces

- Lyubomir December 23, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Inside the park, we can use a hashtable or simply use a linklist, outside the park there might be a buffer, we can use a queue.

- leiwen14 January 10, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I would use a hashmap to map the parking spot to the car parked on it.

I would use a heap to keep track of empty slots as u can define some ordering(distance to be travelled to park or frequency by which a person uses a car etc..) on the empty slots

- prabhu February 23, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I will consider the problem as producer/consumer problem.
- producer are the cars waiting to park
- consumer are the cars parking out.
- the shared resource (buffer space) is the size of the parking.

The rest is direct implementation of the problem.

- Ognian.Kabranov May 23, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Can't we use a queue of indices queue<row,col>
The following would be the operation
- when car arrives, check is the queue is empty or not?. if not empty allocate the front element to the car and pop the front element
- when car leave the parking space, push it to the back of the queue

- rohan August 10, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Why heap?

- Pregnant December 22, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 vote

I would like to use heap DS. Which has a perfect ordering.

- Mirza December 22, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 vote

Because, heap's space and time complexities are very efficient. Just browse through the Wiki for Heap datastructure. If you can customize your functions then time complexity can be reduced polynomially.

- Mirza December 22, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

hey guys small info.....HEAP retrieve at its node so it accessed in O(1)...searching for empty slot in heap is not a efficient way...so heap is not suitable for this ...

- learner : February 14, 2013 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More