Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

subject - data structure and algorithms please read the requirements hopefully this works please do read all requirements Implementation of meryesort wing linked list ideas

subject - data structure and algorithms
please read the requirements
image text in transcribed
image text in transcribed
hopefully this works
please do read all requirements
image text in transcribed
image text in transcribed
Implementation of meryesort wing linked list ideas for tables Requirements: 1. Write a program to read an input sequence and then produce an array of links giving the values in ascending order. The first line of the input file is the length of the sequence (n) and each of the remaining n lines is a non-negative integer. The first line of the output indicates the subscript of the smallest input value. Each of the remaining output lines is a triple consisting of a subscript along with the corresponding input sequence and link values 2. Submit your program on Blackboard by 12:45p.m. on February 17. One of the comment lines should include the compilation command used on OMEGA (5 point penalty for omitting this) Getting Started: 1. Your program should read the input files by using Unix shell redirection (eg, a.outlabl.dat) to read the input from stdin (C). By using redirection, it is unnecessary to explicitly open and close the input file, nor should your program prompt for a file name. You should dynamically allocate tables for storing the input keys and the table of links. Unlike the mergesort in Notes 1 and CLRS, the table of keys is not modified. 2 The link values are not initialized before the recursive mergesort begins. Each link will be initialized to -1 when its sequence value is placed in a single-element list (at the bottom of the recursion's "tree") 3. The input sequence way and the link ay may be global Under this assumption, the following prototype may be used: int mergesort(int start, int count) where start is the first subscript for a subarray of count elements. The returned int is the subscript of the first element in the resulting sorted sublist. The last element in the sublint will have a link value of -1. 4. The critical part of the code is a linear-time merge of two subarrays that previously had their link values set for ordered sublists. (Be sure to understand the mering concept from pp. 34 of Notes I before proceeding.) The merge will revise the link values to give a single ordered list. 5. Han luput vous permeten oce, those elements should be ordered by subscripts in the final in YOGENI code will be stable 6. Consider the following input file The output (as subcript valutlink triples) will be Pue element is at vubecript 15 - 1 2 24 > 340 21:17 first line of the input file in the length of the sequence (a) and each of the remaining lines is a non-segative The first time of the output indicates the subscript of the smallest input value. Each of the remaining outputlines triple consisting of a subcript along with the corresponding input sequence and link values Canvas 2. Submit your program on Bilant by 12:45pm. on February 17. One of the comment lines should include the compilation command used on OMEGA (5 point penalty for emitting this) Getting Started: 1. Your program should read the input files by using Unix shell redirection ( e.out 340 21:17 first line of the input file in the length of the sequence (a) and each of the remaining lines is a non-segative The first time of the output indicates the subscript of the smallest input value. Each of the remaining outputlines triple consisting of a subcript along with the corresponding input sequence and link values Canvas 2. Submit your program on Bilant by 12:45pm. on February 17. One of the comment lines should include the compilation command used on OMEGA (5 point penalty for emitting this) Getting Started: 1. Your program should read the input files by using Unix shell redirection ( e.out

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

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago