Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Structures Static and Dynamic. Learning Objectives Explain the difference between static and dynamic implementation of data structures, highlighting.

Similar presentations


Presentation on theme: "Data Structures Static and Dynamic. Learning Objectives Explain the difference between static and dynamic implementation of data structures, highlighting."— Presentation transcript:

1 Data Structures Static and Dynamic

2 Learning Objectives Explain the difference between static and dynamic implementation of data structures, highlighting the advantages and disadvantages of each.

3 Static Data Structures Structures that do not change in size while the program is running. e.g. Arrays e.g. Arrays As once you declare their size, they cannot be changed. Actually there are some languages that do allow the size of arrays to be changed in which case they become dynamic data structures. Actually there are some languages that do allow the size of arrays to be changed in which case they become dynamic data structures.

4 Advantages Of Static Data Structures Compiler can allocate space during compilation. Easy to program. Easy to check for overflow. An array allows random access.

5 Disadvantages Of Static Data Structures Programmer has to estimate the maximum amount of space that is going to be needed. Can waste a lot of space.

6 Dynamic Data Structures Structures that can change size while a program is running. e.g. Linked Lists in AS section. See Linked Lists Presentation in AS section.Linked Lists Presentation Binary Trees We will look at what these are later in the Binary Trees Presentation. We will look at what these are later in the Binary Trees Presentation.Binary Trees PresentationBinary Trees Presentation

7 Advantages Of Structures Advantages Of Dynamic Data Structures Only uses the space needed at any time. Makes efficient use of memory. Storage no longer required can be returned to the system for other uses.

8 Disadvantages Of Dynamic Data Structures Difficult to program. Can be slow to implement searches. A linked list only allows serial access.

9 Plenary Give an example of a dynamic and static data structure? What is the difference between a dynamic data structure and a static data structure?

10 Plenary Dynamic data structure: Linked list Linked list Can alter size dependent upon the number of items stored. Can alter size dependent upon the number of items stored. Static data structure: Array Array Remains a fixed size throughout its use. Remains a fixed size throughout its use.

11 Plenary What are the advantages and disadvantages of static and dynamic data structures?

12 Advantages Of Static Data Structures Compiler can allocate space during compilation. Easy to program. Easy to check for overflow. An array allows random access.

13 Disadvantages Of Static Data Structures Programmer has to estimate the maximum amount of space that is going to be needed. Can waste a lot of space.

14 Advantages Of Structures Advantages Of Dynamic Data Structures Only uses the space needed at any time. Makes efficient use of memory. Storage no longer required can be returned to the system for other uses.

15 Disadvantages Of Dynamic Data Structures Difficult to program. Can be slow to implement searches. A linked list only allows serial access.


Download ppt "Data Structures Static and Dynamic. Learning Objectives Explain the difference between static and dynamic implementation of data structures, highlighting."

Similar presentations


Ads by Google