This week I have learned something which I haven't quite heard of before. It's the abstract data types. This was quite interesting and was not something as complicated as the name sounds! I actually enjoyed attending the lectures.
This week's lab was very much fun as well. I particularly enjoyed understanding the reason behind the increasing run-times of different methods of the queue ADT, as the number of items in the in the queue is increased.
However, I did find solving the puzzle which Dan showed us in class quite difficult, particularly using a stack. The balanced parenthesis problem also was very challenging to solve. To be honest, I am still not confident of being able to solve these problems by my own.
I believe the above challenges can be overcome by constant practice and dedication. One way to do this might be to think of scenarios in the real-world and try to solve problems using these ADTs. This can be of anything: for example, designing a program which will keep record of all the sales in a store for a day. Here, a dictionary can be used to record the details of each sale, which can then be stored in a queue ADT; so that it can later be reviewed starting from the very first sale, till the last. This example is just one of many one could potentially come up with. (I think it would be great if Dan posted some more problems for us to solve using these ADTs.)
Actually I had some time after finishing this week's exercise, so I myself designed some small programs using stacks and queues to enhance my skills in using these abstract data types.
I would really like to know what others have to say about my thoughts and approach. So I am really expecting others to share their views and/or suggestions.
Delightfully well-written!
ReplyDeleteThe queue for a point-of-sale system is interesting. One difficulty would be that it might be somewhat hard to review a sale before the end of the day without dequeuing the other sales in the way, in which case you can no longer put them back where they were! But as long as you didn't need to do that, I think it'd be a fine way of keeping it all in chronological order.
Thank you!
ReplyDeleteGood point there! However, I was just trying to explain how we can think of making use of ADTs. In real-life, I believe there are way more better and advanced methods of keeping records.