Professional Documents
Culture Documents
Data Structure Assignment
Data Structure Assignment
#include <string>
// Function to perform bubble sort on the linked list based on student IDs
void bubbleSort(Student* head) {
bool swapped;
Student* ptr1;
Student* lptr = nullptr;
do {
swapped = false;
ptr1 = head;
if (head->IDno == IDno) {
Student* temp = head;
head = head->next;
delete temp;
return;
}
if (current->next == nullptr) {
return; // Student not found
}
if (position == 1) {
newStudent->next = head;
head = newStudent;
return;
}
newStudent->next = current->next;
current->next = newStudent;
}
int main() {
Student* head = nullptr;
return 0;
}