Your question is Array and Linked List Coding. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Atlas Copco SMARTLINK receives compressor alerts in a singly linked list. Given an integer array priority, reorder the list so that alerts whose values appear in priority are grouped first in the exact order specified by the array. Alerts with values absent from priority must follow afterward in their original relative order.
If multiple linked-list nodes have the same alert value, preserve their original relative order within that alert group. Relink the existing nodes instead of creating replacement nodes.
Implement prioritize_alerts(head, priority).
head is the head of a singly linked list whose nodes contain an integer val and a next pointer.priority is an array of unique integers.None.[4, 2, 7] represents 4 -> 2 -> 7.def prioritize_alerts(head, priority):