The George Washington University
School of Engineering and Applied Science
Department of Electrical Engineering and Computer Science
CSci 131 - Data Structures
Week 8 Homework
1. Declare access type declarations to point to each of the following types:
a. An upper-case string of unspecified length
b. A record containing integer pound and floating-point ounces
c. An array of twenty-five Boolean values
d. A single integer value
2. Given the following assignments:
Pointer_1.ALL := 2;
Pointer_2.ALL := 3;
Pointer_3 := Pointer_2;
Pointer_4.ALL := Pointer_1.ALL;
Evaluate the following:
a. Pointer_1.ALL
b. Pointer_2.ALL
c. Pointer_3.ALL
d. Pointer_4.ALL
3. Why do dynamically allocated variables have to be allocated from a pool of memory different from the pool of memory used to allocate ordinary variables?
4. Explain why a linked list is more flexible than an array.
5. Write a function that accepts a pointer to the head of a singly linked list of integers and an integer constant as parameters. The function should return the number of occurrences of that constant within the list.