This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: COP 3503 Computer Science II CLASS NOTES - DAY #14 As we begin the second half of the course, our focus shifts from examining problem-solving techniques and asymptotic algorithm analysis toward the issues involved with the implementation of the basic data structures which support the problem-solving techniques incorporated in our algorithms. For most of the data structures that we have examined a basic implementation issue centers on whether the structure is implemented in a static or dynamic fashion. The selection of a static or a dynamic implementation often depends on problem specific issues commonly related to either speed of execution or knowledge of the size of the problem instances which are to be expected. A static implementation implies that the structure will be implemented using an array. In most (but not all) programming languages arrays are statically allocated chunks of contiguous memory addresses. A dynamic implementation implies that the structure is implemented using memory locations which are allocated during execution of the algorithm. Since the program is in execution at the time a memory request occurs, support from the run-time environment is required (this means OS support). This run-time support comes with a price tag of increased overhead in the execution of the program (the overhead manifests itself primarily in terms of time) with the benefit of implementation and instantiation flexibility. As we move, once again, through a number of different data structures, you should keep in mind that most of them can be implemented either statically or dynamically. For some of them we will look at both types of implementations, but for the most part we will be assuming a dynamic implementation. As we examine the implementation issues surrounding these data structures we will focus predominantly on two areas: (1) ensuring that the implementation satisfies the asymptotic behavior that we expect for the various operations that are allowed on the structure, and (2) the implementation is done in such a way that it is efficient in time and space while incorporating the design aspects of the OOP paradigm. Traditionally, dynamic structures imply the use and manipulation of pointers or pointer variables . There is a common misconception that Java does not support pointers. This is not true, per se. In Java, every variable that is not one of the primitive types is a reference type. Such a variable is can be thought of as a reference to (or a pointer to ) an object of the appropriate type. Thus, Java supports references and not pointers. The primary difference in this area between, say Java and C, is that C supports pointer arithmetic and Java does not. This is a safety feature incorporated in Java which prevents access through a pointer to an address Day 15 - 1 Implementation Issues outside the addressing scope of your program and prevents either accidental or malicious memory address violations....
View Full Document
- Summer '09
- Computer Science