


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



The prerequisites for CSCE 351 are CSCE 230, CSCE 230L or CSCE 231, and CSCE
Consider the following definitions for functions that operate on a list L. A) End( L ). Return the position following position n in an n -element list L. B) INSERT( x, p, L ). Insert x at position p in list L , moving elements at p and following position to the next higher position. That is, if L is a 1 , a 2 , … an , then L becomes a 1 , a 2 , …, ap-1, x, ap, …, an. If p is END( L ), then L becomes a 1 , a 2 , …, an, x. If list L has no position p , the result is undefined. C) RETRIEVE( p,L ). This function returns the element at position p on list L. The result is undefined if p = END( L ) or if L has no position p. D) DELETE( p,L ). Delete the element at position p of list L. If L is a 1 , a 2 , … an , then L becomes a 1 , a 2 , …, ap-1, ap+1, …, an. The result is undefined if p = END( L ) or if L has no position p. E) NEXT( p,L ) and PREVIOUS( p,L ) return the positions following and preceding position p on list L. If p is the last position on L , then NEXT( p,L ) = END( L ). NEXT is undefined if p is END( L ). PREVIOUS is undefined if p is 1. Both functions are undefined if L has no position p. F) FIRST( L ). This function returns the first position on list L. If L is empty the position return is END(L). G) PRINTLIST(L). Print the elements of L in the order of occurrence.
Consider the following tree: