Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Tried it and it came out wrong? any other alternative solution to this? Only write pseudocode. Sort (in ascending order) the items in a file

Tried it and it came out wrong? any other alternative solution to this?

image text in transcribed

Only write pseudocode. Sort (in ascending order) the items in a file of size 2* KIB using limited memory. Note that x is a unsigned integer where x>0. (1) RULES are The file is in disk (not in memory). Memory is limited to 2 input buffers and 1 output buffer (4KIB each) Total memory capacity 12 KIB. o the contents of the file are unsigned integers separated by a comma delimiter. (i.e 3,1,3,100,99...) The unsigned integers are not sorted. The file can contain duplicated integers. When in a file, a digit from an integer is 1 byte (datatype is char). When in a buffer, an integer is 4 bytes (data type is integer). Pass number can only use the output buffer. All the remaining passes can use all the available buffers in memory All the buffers in memory support +4 bytes of additional memory allocation. ix. You must use a Divide and Conquer algorithm to solve this problem. Temporary files, in disk, can only hold a max size of ((#pass + 1) + 4) KIB (2) Input and Output o Input: a file containing unsorted unsigned integers in the range of 0 and 100 (both inclusive). For example: 100,67,99,99,1,1,3,24,88,96,37,10,10,88,100,99,99 o Output: A file containing the sorted integers from the input file. For example: 1,1,3,10,10,24,37,67,88,88,96,99,99,99,99,100,100 All This Work to do 1. Describe the algorithm to solve the problem for a given file of size 25 first, and then describe the algorithm for a given file of size 2* (any given x). Note that x is a unsigned integer where x > 0. You can use tables, diagrams, pics, paragraph description.... to describe the algorithm. Be as clear as possible, and define clearly each step taken during the process. 2. Write the only pseudocode (no code) that represents your algorithm from problem. 3. Compute the complexity function, the I/O cost of operations, and the (g(n)) time complexity of your algorithm using your pseudocode from problem (2). For the complexity function and time complexity use the substitution method and then check your result with the Master Theorem. For the 1/0 cost define it as a function of N. Where N is the number of blocks (4KIB) in pass 0 of this algorithm. 4. Modify your algorithm from problem (1) to support files of any size (not only 24). For instance in problem (1), we were assuming that the file size is in the form of 2% such as 2KIB, 4KIB, 16KB..... However, your new modification should include files of any size such as 3KIB, 37KIB In addition, do you think that the time complexity of this algorithm has been optimized because of the modifications applied? Why

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

What are the stages of project management? Write it in items.

Answered: 1 week ago

Question

why do consumers often fail to seek out higher yields on deposits ?

Answered: 1 week ago