CIS3355:
Business Data Structures |
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
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
|