Download Static and Dynamic Data Structures

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts

C syntax wikipedia, lookup

Reactive programming wikipedia, lookup

Stream processing wikipedia, lookup

Array data structure wikipedia, lookup

Linked list wikipedia, lookup

Data-intensive computing wikipedia, lookup

Corecursion wikipedia, lookup

Transcript
For The exam:





explain how static data structures may be used to implement dynamic data structures;
describe algorithms for the insertion, retrieval and deletion of data items stored in stack, queue and tree
structures;
explain the difference between binary searching and serial searching, highlighting the advantages and
disadvantages of each;
explain how to merge data files;
explain the differences between the insertion and quick sort methods, highlighting the characteristics,
advantages and disadvantages of each.
Static and Dynamic Data Structures
IN Year 12 we have already discussed a number of data structures. Can you name the different types
of data structures below:
Data Structure
Description of what it is
When we talk about things being static of dynamic, there are a number of things you need to
consider. A static person is BORING:
he sits there all day every day and never changes
A dynamic person is different:
He’s always moving and always got some new ideas about how to do something
Which one would you rather be?
When we talk about static and dynamic data structures it’s the same thing. A static structure is
defined at the top of the program and never changes. Whereas a dynamic one can change
throughout the program, however this is not easy (dynamic data structures tend to be more
complex to define and therefore beginner programmers tend to stay away!)
Static Vs Dynamic
Write the characteristics of each in the space below
Static Data Structures
Dynamic Data Structures
An Example of a Static Data Structure is:
An Example of a dynamic Data Structure is:
Lists, Stacks, Queues and Trees
These are all different ways that we can use to store data on a computer, and depending on how we
store them and structures we define them in, depends on how they work.
Lists
The simplest form of structure storage is the one dimensional Array. All information in the array is
stored one after the other. This has to be a static list as a specific area of memory has to be
reserved for data to be stored in it
Address
10
11
12
13
14
Data
Chris
Caleb
Josh
Ryan
Matthew
Depending how we draw the contents of the array, depends on the how we can use it. This is called
a linked list. In the space below define a linked list
Addressed linked list
Arrays are a simple form of lists, However there are ways of making an array dynamic. But this has to
use something called a Pointer.
Describe the purpose of Pointers:
Draw a diagram of how pointers work with data structures:
What are the advantages of pointers instead of an array?
Exercise – Programming
Comment the code of linked lists that Mr Gristwood gave you and paste it in here
Extension task
Add some items to the linked list. Then organise them so that they point to each other in
alphabetical order.
Stacks
Understanding pointers is our first fundamental step in understanding data structures. Because once
we understand that we can have a list of data items and sort them (in an array, linked list whatever)
as they are going into the structure, we can come up with some really fantastic ways of getting them
back.