chap listsstacksand queues class link private elementprivate link next/singly linked list node /value for this node /pointer to next node in list /constructors link( itlink nextvalelement itnext nextvallink(link nextvalnext nextvallink next(return nextlink setnext(link nextvalreturn next nextvale element(return elemente setelement( itreturn element it/class link figure simple singly linked list node implementation head curr tail (ahead tail curr (bfigure illustration of faulty linked-list implementation where curr points directly to the current node (alinked list prior to inserting element with value (bdesired effect of inserting element with value of the list the position of the current element is indicated by another pointernamed curr finallybecause there is no simple way to compute the length of the list simply from these three pointersthe list length must be stored explicitlyand updated by every operation that modifies the list size the value cnt stores the length of the list note that llist' constructor maintains the optional parameter for minimum list size introduced for class alist this is done simply to keep the calls to the constructor the same for both variants because the linked list class does not need to declare fixed-size array when the list is createdthis parameter is unnecessary for linked lists it is ignored by the implementation