quiz حل الأسئلة الجامعية manage_search الأرشيف

تم الحل ✓
categoryعلوم الحاسوب schoolبكالوريوس event_available2026-07-15

السؤال

Transcribed Image Text:

When a customer shows interest in a particular author, Amazon thinks the customer might be interested in books written by authors that the customer and author both like. There are many complex algorithms which will be tried to determine the best books to introduce to the customer, but the original data might be destroyed. Given a linked list where each node is an author (value), a reference to the next author ('next'), and a reference to an author the author likes (arbitrary) Input The input to the function/method consists of an argument- head, representing the head of the linked list. Output Return the head of the new linked list to copy the given linked list with the same data and structure at a different memory address. Example Input 1next 2,2.next 3, 3.next = 4; 4.next=null; Larbitrary 2,2 arbitrary 4,3 arbitrary 1; 4. arbitrary = 3; Output 1next 2,2.next 3, 3.next 4, 4.next=null; 1.next = 2, 2.next = 3; 3.next = 4; 4.next=null, 1.arbitrary = 2; 2.arbitrary = 4,3,arbitrary 1, 4.arbitrary = 3; Helper Description The following class is used to represent an ALNode and is already implemented in the default code (Do not write this definition again in your code): class ALNode { public: int value; ALNode ALNode next; arbitrary; ALNode (int val) { this->value = val; this->next NULL; this->arbitrary = NULL; } ALNode () { this->value = -1; this->next = NULL; this->arbitrary NULL; } };

check_circle الجواب — حل مفصل خطوة بخطوة

hourglass_top