wpe41.gif (23084 bytes)CIS3355: Business Data Structures
Fall, 2008
 

Tutorial

Linked list

How would we find an element on a linked list?

    We would have to keep track of the record  we are trying to find by looking  the base address of the first record in some separate location.

                                           

 

Base address

Addr

ssn

name

address

age

IQ

gpa

balance

9200

123456789

Gates, W.

99 Microsoft Ln

38

108

3.87

4500.00

9232

234567890

Ford, H.

17 Michigan Ave

125

115

3.10

250.00

9264

345678901

Trump, D,

1 Trump Tower

55

110

1.86

500.00

9296

456789012

Astor, J.J.

20 Wall Street

76

100

2.76

1000.00

9328

567890123

Carnegie, A.

100 Steel St.

81

79

2.25

0.00

 

 

 

 

      

 

 

 

 

 

Assume that the base address of the database were 9200, we can easily find any record  in the linked list just by

giving the base address. Since we know that each record  requires 32 bytes of storage,  the address of the 5th record must be

for example:

                         9200 + 32 * 4 =  9200 + 128 = 9328

                                                or

for the 4th record

                         9200 + 32 * 3 = 9200 + 96 = 9296

which as we can se, it is.

Knowing the base address of the first element or record and the number of   bytes for each element we can easily find any element on a liked list.

 

References

1.-Liked List

 

 

 

Multiple choose questions

 

1.- What do you need to know in order to fin a record in a like list?

A) S.S.N, Name, Balance

B) Number of bytes for each record, and base address of 1st record

C) Number of record on the list

 

2.- Assume that the base address of the record  3  is 9189 and each record requires 63 bytes

     of storage. What is the base address of the first record

 A) 9063

 B)9126

 C)9252

 D)9000

Answer .-           9189 - 3* 63 = 9189 - 18 9 = 9000