• Home
  • University of the People
  • Data Structures (proctored course) CS 3303
  • Data Structures - Menu Options Heuristics

Data Structures - Menu Options Heuristics

CS 3303 DISCUSSION ASSIGNMENT 7 MENU OPTION 1 - FIFO 1. Describe the heuristic used in menu option 1. With the FIFO used in menu option 1, the algorithm helped arranged the buffers in the queue in an orderly manner such that the new information stored in the buffer which was in the front of the queue was later placed at the end of the queue. This is due to the nature of the menu option used which is FIFO (First in First out) The structure of the queue is such that the buffer holding the information meant to bounce back to the front of the queue as others would have already being ordered to the back of the queue. As this sequence is being followed, there will be a need for a buffer space, hence the need to discard the information initially saved since it is assumed it has held on to the information for a long period of time and thus might not be as essential as it was at the beginning. Thus, new information is loaded after this old one has been discarded. 2. Under what condition will this heuristic not be efficient? The efficiency of the FIFO method is in its ability to read a file in a sequential order. Any other asides this will render it inefficient. Thus, this heuristic design will be most efficient if the value 5 is stuck to. This is because using this value appears often and is more in use than other values. Also, it has a short execution time when compared to others. 3. Describe a situation where this heuristic would be efficient I think the heuristic will be more efficient is the sequential order is maintained and if the secondary storage is not allowed to be accessed by the buffering process. MENU OPTION 2 - LRU (Least recently used) 1. Describe the heuristic used in menu option 2. The Heuristic here works by accessing the buffer at the tail end of the queue or the idlest of them all. This buffer will have the information in it discarded or written to the disk for future use. This happens when there is a need for more information to be assessed or a need for buffer arises 2. Provide an example or define the characteristics of a situation where this heuristic would be efficient. The best design for this heuristic to be efficient is to have the buffer arranged in the order of their frequency of use. This implies the one which appears most often will come ahead of others. In this case, the value 5 will be put in front of the order. MENU OPTION 3 (Least frequently used) 1. Describe the heuristic used in menu option 3. The concept of this heuristic method is such that the buffer that has not been used often, the least used is considered to have information least important. Hence, when there is a need to store a new information or a need