C17s99t2 - CSc 17 Test 2 Thursday 8 April

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSc 17 Test 2 Thursday 8 April 1999 .....>>>>>>>>>>>>>>>>>>>>>>ANSWERS<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 1. (10 pts) Assume the following data structure is used to create a linked list: class Link{public: int key,next; }; class LinkedList{ private: int head,count; Link data[10]; public: //other stufff } Further suppose that data have been loaded into the array as depicted in the first row of the table below but that the data are not yet linked together. Complete the first row by filling in the value for head. Also, fill out as many of the remaining rows as is necessary to show the state of the data structure after each of the entries Link[0], Link[1],..., Link[3] is added to the list. Note that a link is depicted as ------ | key | | next|------- head count Link[0] Link[1] Link[2] Link[3] Link[4] Link[5] .......----------------------------------------------------------------------- | -1 | 4 | 5 | 6 | -3 | 10 | | | .......-----------| | | | | | | .......----------------------------------------------------------------------- | 0 | 4 | 5 | 6 | -3 | 10 | | | ..........
View Full Document

This note was uploaded on 03/09/2008 for the course CSE 17 taught by Professor Varies during the Spring '08 term at Lehigh University .

Page1 / 3

C17s99t2 - CSc 17 Test 2 Thursday 8 April

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online