Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.6 kB
2
Indexable
Never
You can write your answers the provided space or write your answer on a piece of paper and scan and upload the handwritten answers using the QR Code available in the Scan and Upload Section of this exam. Kindly ensure all answer sheets to be uploaded against the corresponding questions only. All sheets should not be uploaded against one question. On the day after the results were declared, Prof. Bhide planned to trick with Jethalal. He has a singly-linked list of students with their names and scores. Prof. Bhide asked Jethalal to update the linked list where a 268 students with odd scores will be on the left side of the students having even scores. Prof. Bhide restricted Jethalal from using any additional data structure. However, he is free to use additional pointer variables t linked list nodes. He also instructed that the sequence of students having odd scores must be as it is in the input. Header to the linked list is given. Write the complete algorithm "Jetha" as your answer. In the following sample inputs/outputs are given for your understanding. However, your algorithm must work for vall possible inputs. (5 Marks) KOM KOMA 22 Sample input 1: (Tapu, 90) (Sonu,99) → (Goli, 51) (Gogi, 66) → (Pinku, 77) Sample output 1: (Sonu,99) (Goli, 51) (Pinku, 77)- (Gogi, 66) (Tapu, 90) Sample input 2: (Tapu, 91) → (Sonu,99) → (Goli, 51) → (Gogi, 66) - (Pinku, 76) Sample output 2: (Tapu, 91) → (Sonu,99) - (Goli, 51) → (Gogi, 66) - (Pinku, 76) KOMAT 268112 Sample input 3: (Tapu, 92) → (Sonu,98) → (Goli, 52) - (Gogi, 67) (Pinku, 75)
Leave a Comment