Topic 2 - Collections Flashcards
Give examples of collections.
Queue: first item in is first item out e.g. a lineup at a checkout counter
Stack: last item in is first item out
List: we can have ordered or unordered lists
Describe linear collections.
items are organized in a “straight line”
Give an example of a nonlinear collection.
Hierarchical collections: trees, graphs
Define trees.
- items are ordered in an “upside down tree”
- each item except the one at the top has a unique predecessor but may have many successors
examples: taxanomies, computer file systems
Define: abstraction
- Abstraction separates the purpose of an entity from its implementation
- provides a way of dealing with the complexity of a large system
What are stacks, ques, lists, trees etc?
What are integers, booleans, doubles?
Abstract data types.
Data types.
Define: data structure
A construct within a programming language, used to implement a collection
Define: collection
a group of items that we wish to treat as a conceptual unit
Define: interface of the collection.
What we need in order to interact with it ie. the operations on collections
Define: implementation of the collection.
the underlying details of how it is coded
Define Abstract Data Types
A collection of data together with the set of operations on that data
Define Data Type
A set of values and the operations defined on those values ex. integer data types
Why are ADTs abstract?
Its a data type who’s values and operations are not inherently defined in a programming language