In: Computer Science
Question 1: Using Python 3 Create an algorithm
The goal is to create an algorithm that can sort a singly-linked-list with Merge-sort. The program should read integers from file (hw-extra.txt) and create an unsorted singly-linked list. Then, the list should be sorted using merge sort algorithm. The merge-sort function should take the head of a linked list, and the size of the linked list as parameters.
hw-extra.txt provided:
37 32 96 2 25 71 432 132 76 243 6 32 634 5 42 73 61 48 43 190 211 69 404 98 984 2 83 58 194 89 470 90 80 40 51 77 622 642
Goals
1.) Read from the provided file (5pt)
2.) Stores the contents of the files to an unsorted, singly-linked list of INTEGERS (5pt)
3.) Sort all elements in the list in ascending order using merge sort (10pt)