Below is the knowledge and skills required to complete this lesson:. I am sure that I sorted it correctly, but probably my printStack function is not working properly. This program will use Linked Lists to simulate different data structures. But when I run it that is what I get (C, B, A are the names given by me): Enter Choice: 2 Linked Lists can be used to implement graphs (Adjacency List representation of graph). Linked Lists can be used to implement hash tables, each bucket of the hash table can be a linked list. ![]() When, for example, the choice is 2, I want to display the student name and whole rollnumber in ascending order. Here you can see that it is a simple singly-linked list node with two properties data & link to the next node. Linked Lists can be used to implement useful data structures like stacks and queues. Printf("1 - Enter school number\n2 - Display school numbers by ID\n3 - Display school numbers sorted by year\n4 - Display school numbers sorted by the faculty codes\n5 - Delete a record by school number\n6 - Exit") Printf("Roll Number: %lu\n", temp->rollnumber) Printf("Student with roll number %lu is not found\n", rollnumber) the record that we need to delete is the first node Printf("Record with roll number %lu Found\n", rollnumber) Each node contains a pointer to its immediate successor. Void Delete(unsigned long int rollnumber) In linked list implementation of stack, the nodes are maintained non-contiguously in the memory. Struct Student * student = (struct Student *) malloc(sizeof(struct Student)) Void insert(unsigned long int rollnumber, char* name) If (isEmpty(*s) || x rollnumber, temp->name) item is less than top (more than all existing) ![]() Base case: Either stack is empty or newly inserted Void sortedInsert(struct stack** s, int x, unsigned long int rollnumber, char *name) Recursive function to insert an item x in sorted way
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |