Need help from daniweb community. I suck at programming. It doesn't make sense to me. I'm not going to be programming in my career but it's part of my major. I'm desperately trying to get an c- just to pass. Would love some help. I would appreciate some explanation but it is not necessarily needed.

Given the following struct:

typdef struct node {
    int data;
    struct node * left;
    struct node *right;
}tNode, *treeNode;
typedef struct list{
    int data;
    struct list *next;
}lNode, *listNode;

First insert random numbers into the linked list
listNode generateList ( listNode head, int size ); (10 points)
Ask user to define the size of the list, like 100, 10000, etc.
In the function use rand() to create numbers from 0 to (size-1), then store the numbers in the linked list.
You can either insert the node from the beginning or the end of the list.

Then sort the linked list using different sorting algorithms:
First…
Tree Sort
listNode treeSort(listNode head); (20 points)
The algorithm using a BST to sort the elements of an array is given in the slides.
The basic idea of tree Sort of a linked list is as follows:
1. Insert values in the linked list into a BST.
2. Perform an inorder traversal of the BST and write the values back to the list in sorted order.
Functions needed:
1. treeNode BuildBST(treeNode root, int val); (20 points)

2.listNode flatten(treeNode tree, listNode head);(30 points)

Perform an inorder traversal of the BST and write the values back to the list.

Second
Use merge sort to compare the result.
Merge Sort
listNode mergeSort(listNode head);

Remember to free the allocated memory at the end.

Thanks to anyone willing to help me out.

Have you tried to write any code yet? If you have, please post it and we can pick up where you left off. If not, that's fine too--I'm just trying to find a helpful starting point.

Also, what's your major?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.