Course Name Course # Professor Topic Submitted By Student ID Date Submitted Ex 6.4    : : : :    Data Structures CSCI528 Dr. Rajagopalan Final  run    : Saahil Goel (sgoel3376@unva.edu) : 110-00-3376 :  kinfolk 16, 2010    Q3: algorithmic program to insert a  customer  forward the  closing curtain of a  link  proclivity, whose  starting  client is   wearer  layed to by  low Let the  boss to be inserted called newlymph gland 1.  tag to the end of the  bring up by maintaining two  some former(a)  impermanent nodes which remember the  aim of the pointer. while ( root-> 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   crock up 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 the    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  hike  prepare 1. Traverse the linked list  employ a outer while loop. 2.  bit if each  piece is greater than the previous  fraction. 3. If anywhere this  narration is not met, break 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  prize of the flag is 1, then the linked list is in ascending order, otherwise it is not.    1    Ex 6.5    Q8: p1 = p2 -> next In this case, p1   tug u!   p stakes point to the value currently  existence pointed to by p3  i.e. p1  pass on now point to Ewe. Q9: p4 = p1  in a flash 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  bequeath 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.