VS2010 C++ CST280 Week11 - 51539

Solution Posted by
jordanblink

jordanblink

Rating : (19)A+
Solution Detail
Price: $10.00
Request Description

CST 280 In-Class Practice – Week 11

Capture the following program files from the course web page:

testListB.cpp and linkedListB.h (using code hj93)

Then, complete one of the following functions (as indicated by your instructor):

1) clear() that will completely destroy the linked list and reset the

list head pointer to null

2) appendNote() that will insert a given data element to the end of a list

Deliverables:

• Demonstrate output to instructor.

 

CST 280 In-Class Practice – Week 11

Capture the following program files from the course web page (using code pt73)

Source files: linkedList3.h and lengthFun.cpp

Data files: littledata.txt and bigdata.txt

Refine the linked list class to add two functions to count the number of elements

in the linked list.

1) A recursive function set is included on the backside of this page. Enter this

code and test for correctness.

2) Develop an iterative function to count the number of nodes in the linked list.

Hint: Start with displayList() function and count instead of write.

When ready to execute:

1) Execute your program first with a relatively small data file of integers:

littledata.txt

2) Execute your program next with a very large data file of integers:

bigdata.txt

Deliverables:

• Demonstrate output to instructor running both input files.

template <class ItemType>

int LinkedList<ItemType>::recurseLength()

{

return lengthSub(head);

}

template <class ItemType>

int LinkedList<ItemType>::lengthSub( ListNode<ItemType>*

listPtr )

{

int result;

if ( listPtr == NULL )

result = 0;

else

result = lengthSub( listPtr-> next ) + 1;

return result;

}

Solution Description

VS2010 C++ CST28

Attachments
CST280Week11.zip
CST280Week11.zi...