I wanted to know if there was any other way of doing the below program. The below program works properly, but it's kind of big and cluttered. If this is the most optimal way of programming this then feel free to leave your solution! I'm always looking for different ways of programming. -Thanks! :)
void processorSort() {
if (headNode == nullptr) {
return;
}
int end = LLsize() - 1;
for (int i = 0; i < LLsize(); i++) {
Node* current = headNode;
Node* currentsNext = headNode->next;
Node* currentsNextNext = currentsNext->next;
for (int j = 0; j < end - i; j++) {
if (currentsNextNext->processorID < currentsNext->processorID) {
current->next = currentsNextNext;
currentsNext->next = currentsNextNext->next;
currentsNextNext->next = currentsNext;
currentsNext = currentsNextNext;
currentsNextNext = currentsNextNext->next;
}
current = current->next;
currentsNext = currentsNext->next;
currentsNextNext = currentsNextNext->next;
}
}
}