TD - Linked Lists
TD - Linked Lists
Exercise 1:
Write a program that:
• Reads an integer N (N<=16),
• Reads N real values and stores them in an array.
• Copies the contents of this array into a linked list.
• Sorts the linked list in ascending order.
• Copy the contents of the list into another array.
Write functions that:
• Insert an element at the kth position in the list.
• Inserts an element at the penultimate position of the list.
• Removes the penultimate item from the list.
• Removes the kth item from the list.
For all of these functions, write a main program that allows to test them with several examples.
Exercise 2:
Write a function that reverses the order in the previous list.
Exercise 3:
Write a function that inserts a list L1 at the beginning of another list L2.
Exercise 4:
Write a function that inserts a list L1 at the end of another list L2.
Exercise 5:
Write a function that inserts a list L1 into another sorted list L2. The list L2 must remain sorted.
Exercise 6:
Write a C program in which:
• You declare a doubly linked list (e.g. bidirectional) of real numbers, as depicted in the
following figure: