Advanced Linked Lists
typedef structNODE{
value_tvalue;
key_tkey;
struct NODE* next;
struct NODE* sort;
} Node;
In this linked list:
Create a Sorted List abstract data type
Functions To be implemented
All functions, except where noted,return SUCCESS if the function can complete or FAIL if not
the node must also be inserted in ascendingsortorderby key, using the sort link
O returns the value and key of the removed node (and frees the node)
o remember to update the sort order links if not using doubly linked lists, you will need to find the previous sorted nodeto change its sort order link
removes the node with the smallest key
o returns the value and key of the removed node (and frees the node)
o remember to update the insertionorder links if not using doubly linked lists, you will need to find the previous insert order node to change its insertionorder link
osimilar to remove_smallest_key, except it removes the node with the largest key
O empties the contents of the list
To testthe Sorted List ADT
Write two programs called a4q1a_char.c and a4q1a_int.c
a4q1a_int.c
has its value_tdatatype set equal to int
has it key_tdatatype set equal to double
a4q1a_char.c
hasitsvalue_t datatype set equal to char[80]
has its key_tdatatype setequaltoint
The name of the text file should be entered as a command line argument§If there is no file name, read from stdin
After that the results of the command follows,
The file input will be slightlydifferent depending on the data type and nature of the input data
Your will have to write similar, but not identicalvoid print_list_all(Sorted_List * )andvoid print_list_sort(Sorted_List * )functions
These functionsprint out the lists according totheir respectivesort orders
See the report commands section below for details(the print_alland print_sortcommands)
You will have to have your make file recompile allfiles that mention or usevalue_t and key_tvariables or Sort_List structs when compiling the two programs
To do this you will need to use condition compilation (see Week1 lecture notes)§In specific, use #ifdef CHAR to compile using the char[80] typedef definitionof value_t and #ifdef INT to compile using the int typedef definition of value_t
E.g.if you stored all your Sort_List ADT functions in a single file called sort_list.cThenfor a4q1a_char.cyou could havein your make fileacommandlikegcc -Wall -ansi -DCHAR-csort_list.c
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 31 | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | 1 | 2 | 3 | 4 | 5 | 6 |