 Welcome to this course on data structures and algorithms. Today we will be revisiting an example that we had discussed earlier namely the Mumbai Vada power restaurant. You will recall that we had implemented that particular operation using queues. This time we will see how less could be meaningfully used to implement the same functionality. You will recall that in the earlier version there was a function called order goes kitchen where the information of order was placed and the preparation time for that order was loaded in an array. Now, instead of an array we would like to use a list. So, the same information about the order placed and the preparation time will be loaded in a list of type structure kitchen. Let us recapitulate the various data structures quickly. Maintaining information for food and customer arrival was in a structure called food info and customer info. Then there was a customer queue which contains information about the customer arrival etcetera. Next we were to maintain information about the orders placed and the order that goes to the kitchen for preparation. So, we had an order structure which contains information of the order that is token ID cost to be paid etcetera. Kitchen was the main structure which contains information stored in the structure order along with the preparation time for that order. Then there was an order dispatch queue which contains token ID of the order which is ready to be collected by I guess. The function that we had written were load menu which will load all the items which are available on the menu which set food items which will load the complete menu. In the load menu we will be setting up individual food items. Next the customer arrives functions actually adds a customer to the customer queue. Place order is another function which gives the token ID and cost assigned for every order that has been placed. Order goes to kitchen is the important function you will recall earlier we had used an array. Now the information about order place and preparation time will be loaded in the list. Dispatch orders of course is already we have seen earlier the orders which are ready to be collected. Now we are not going to relook at the entire program we will only look at the modified function and class of the Mumbai Vada power restaurant. The entire program with appropriate modifications for the functions is displayed under the slide unit on IIT Bombay X. So here is the program the class restaurant which was earlier written slightly differently this time notice that I have list. So list in kitchen is a list of the type kitchen that has been added here rest of it is same. Next I have the function order goes to kitchen. Now in order goes to kitchen what we are doing is we said K dot order to order we said K dot preparation time to prep time. Now we push back this K into the list in kitchen. So this is the difference because now we are dealing with a list and not with an array. Here is an important thing earlier also we did that we wanted to sort the array on the preparation time or dispatch time instead now we have a list. So notice this function restaurant dispatch orders it has list in kitchen dot sort. How will it sort? It will sort using a comparison which is stipulated in another function. What does it say? First dot preparation time less than second dot preparation time if that is true it will return true other it will return false. Please note that this function compare itself is being passed as a function pointer in this sort statement. So the list will be sorted using this compare function which is written here. All that we now to do is that once the list in kitchen is sorted as long as it is not empty I keep pushing the order dot token id from the sorted list that I would have got by using this statement. One by one the order will be sent to the dispatch it will be pushed out and that is the end of this function. The output will be same because we are giving exactly the same input to the program that we did earlier. We will have exactly the same you can verify that by running this program. To conclude in this particular session we saw how the Mumbai Vada Pav restaurant operations can be implemented using a list instead of an array. Please note two important things the declaration and handling of the list and second this sorting of the list in this particular case we have used a function pointer to indicate what should be the comparison operation done for sorting. Thank you.