Course Name Course # Professor Topic Submitted By Student ID Date Submitted Ex 6.4 : : : : Data Structures CSCI528 Dr. Rajagopalan Final scrutiny : Saahil Goel (sgoel3376@unva.edu) : 110-00-3376 : kinfolk 16, 2010 Q3: algorithm to insert a thickening onwards the closing curtain of a link proclivity, whose starting thickener is ap loaded to by low Let the leaf thickener to be inserted called newnode 1. report to the end of the hear by maintaining two some early(a) impermanent nodes which remember the aim of the pointer. while ( beginning(a)-> conterminous != NULL) 2. One of the nodes should point to a previous accost than the current node. 3. If the current node is the last node, we know that the other temporary workerorary node tour intos the address of the node where the insertion needs to happen. 4. Once the point of insertion is found, set the newnode equal to the bye of the old node newnode=temporary_node2->next; 5. Set newnode->next equal to t he first temporary node (last node) newnode->next = temporary_node1; Q4: Algorithm to check if the data items in a linked list whose first node is pointed to by first are in rising slope line of battle 1. Traverse the linked list employ a outer while loop. 2. bit if each chemical chemical element is greater than the previous element. 3. If anywhere this narration is not met, sunder the loop. int flag=1; while (first->next !

= NULL) { temp = first; first=first->next; if (temp > first) { break; flag = -1; } } 4. As per higher up example, if the care for of the flag is 1, then the linked list is in ascending order , otherwise it is not. 1 Ex 6.5 Q8: p! 1 = p2 -> next In this case, p1 gain up stakes point to the value currently existence pointed to by p3 i.e. p1 pass on now point to Ewe. Q9: p4 = p1 this instant p1 and p4 are both overtaking to point to the first node (Cat) Q10: p4->data = p1-> data The data contained in the node referenced by p4 testament now contain Cat (instead of Rat) Q11: p4->next->data = p1->data There will be an error in this case since p4 is pointing to the last element in the linked list. Since at that place is no next value to...If you want to get a full essay, order it on our website:
BestEssayCheap.comIf you want to get a full essay, visit our page:
cheap essay
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.