Sei sulla pagina 1di 3

Stack and Queues: 1. Implement push(),pop() and peak () for a stack using array . Now do it with linked list.

counters : Implementing it with array , if you define a definite size of array , and once it becomes full, How will you handle this ?. (HINT : Just a check on size) Imp thing : With linked list implementation they are going to focus on how you play with pointers . Main focus on your node structure .With array implementation they will focus mainly on pop() function. 2. Same goes for Queue as well . Enqueue() , dequeue() ,getFront() , getRear() .
3. Implement stack using queues i.e. you are given enqueue and dequeue

functionality , and you have to imlement push(), pop() . Thing to remember is you are given FIFO and you should implement LIFO. 4. Implement a queue using stack . Same conditions as above.
5. Now the variations(my fav.) :

a. Implement a stack using singly linked list suck that basic operations push ,pop take O(1) . b. getMin() is a function that returns the lowest element inside the stack. Implement this function. Done? now, do it in such a way that it should take O(1). c. Implement a queue using linkedlist such that basic enqueue and dequeue takes O(1). d. Done above with how many pointers? No problem, now reduce the number of pointers used and try to do it with just one pointer.Complexity remains the same. HINT: Data structure at the backend is designed by you only. How will you design such that the requirement is achieved. e. Implement getMin() for your queue also . Complexity remains constant. HINT: were you able to do quest 4? :P

f. Reverse a queue . Reverse a stack as well . Reverse means reversing the content of a given stack or queue Stack A : 1,2,3,4,5 . 5 being the top . Reverse(A) becomes 5,4,3,2,1 . 1 is top now.Same for queue g. Implement two stacks in one array. Done? Now implement 3 stacks? Done this even? Try 4 stacks in one array now :P . If you are able to do this, then you can implement N stacks in one array at a time,if the size is N. (This is just a variation, till 3 stacks in an array is important).

NOTE: The logic for all these questions is important. If you arent able to write the code. Try to convince the interviewer by explaining him the logic and that too with confidence.He should understand that you will be able to write the code as you explained the logic. OTHER: 1. You should be able to justify the things you are using. For example if you use for loop , then why not while ? why not do while ? 2. Using conditional statements can be countered. Why not ternary operator ? Whats the drawback. 3. I pointed above about Node structure. You should also be comfortable with typedef definition of your Node structure.its very important. 4. Dynamically allocating 2D array, 3D also, with all variations.Test your C will help. 5. Swapping two numbers with different approaches.Their pros and cons. Which one is ultimately best among all? TIP for Aricent(Look whos talking :D :D ) : Well, apart from going to those who make it to a company, I used to ask those who were not able to .That always will give you things you should keep in mind.So, for aricent :
1. Remember BE CONFIDENT. This is most important not just from

aricent point of view but also for other companies.

2. Prepare your projects well. They just want to know whether you did it yourself or not. Theyll ask what problems you faced in the project and how were you able to solve it.Again you should be confident in explaining your part of the project. 3. Dont loose temper ( :P ) .. Means theyll dig into details of a particular thing just to test your patience level. Be calm and keep answering, take pause while you speak. 4. Also they could distract you by saying your marks are very less even if youve scored 90+. Thats a way of testing the patience level. Camly reply to this as well .What?I dont know 5. Give time to Criticle incident form a day before aricent. Prepare that as well.
6. For written prepare verbal reasoning well. Syllogism, Data sufficiency,

Blood relation, Coding/Decoding.For data structure written youll be asked questions on complexities, relation between node/height of tree, edge/vertices of graph. Complexities and number of comparisions taken by sorting algorithms. So in all , a very basic written will be asked.Read the questions properly because youll think it is easy and you are likely to neglect few points.All the best for 5th and 6th . Cheers: +vaibhav.

Potrebbero piacerti anche