Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Anyone could the me with this question in c++? Have tried with a string que but not getting it to work correctly. While working on
Anyone could the me with this question in c++?
Have tried with a string que but not getting it to work correctly.
While working on a new filesystem, KattisFS, Kattis has encountered the problem of fragmentation. A file is fragmented when it uses multiple disk blocks that are not contiguous (stored together in the same part of the disk). In her first implementation, the data got spread out over the disk, which makes access to the data very inefficient. In addition, she has noticed that data stored close to the edge of the disk, where the rotation speed is higher, can be accessed faster, and she wants to take advantage of this to speed up access to high priority files. Given the current layout of the data on a full disk, can you help her defragment the data, and reposition the files with highest priority so they are stored where the disk is fastest? Input The input consists of at most 100 disk maps. Each disk map uses several lines of text (between 1 and 100) to show the mapping between files and disk blocks. Each line represents the disk blocks used by one file. Each disk can store up to 80 blocks of data. A star (*) at line i and column jindicates that file i uses disk block j; otherwise a period (.) indicates that the file is not using that block. A file may require zero blocks to store on disk, if it is empty. The disk is guaranteed to be full, so each block is assigned to a file, and no block is assigned to multiple files. Files are given in order of priority, with highest priority files first. Fastest access is to the right. Between each pair of disk maps is a blank line, and the input ends at end of file. Output Output a map of the disk, where the files are defragmented and displayed in priority order. Each file should be stored contiguously on the disk, with the highest priority files stored where the access speed is highest. Print a blank line between each each disk map. Do not print a blank line after the last map. Sample Input 1 Sample Output 1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started