Friday, October 16, 2009

Operation 8 – List Count/Size:

List count is another simple, one-line module. It is necessary because the calling module has no direct access to the list structure. Its implementation is shown in Algorithm 8.

Algorithm – 8 Linked list count

algorithm listCount (val list )

Returns integer representing number of nodes in list.

Pre list is metadata structure to a valid list

Return count for number of nodes in list

1 return (list. count)

end listCount

No comments:

Post a Comment