Data Types, Data structures and algorithms 1.4 Flashcards
What data type should be used for storing a phone number?
String - if stored as an integer this would remove the zero at the start of the number
What is an Array?
An ordered, finite set of elements of a single type
How can you visualize a two-dimensional array?
A spreadsheet or table
How can you visualize a three-dimensional array?
A three dimensional array can be visualized as a multipage
What is a record?
A row in a file
What is a record made up of?
A record is made up of fields
What is the definition of a list?
A data structure consisting of a number of items. Items can appear more than once
What are the main differences between an array and a list?
- List can store data Non-contiguously whereas arrays store data in order
- List can store many data types
What is a tuple?
An immutable, ordered set of values of any type
What is the difference between a tuple and an array?
Tuples use normal brackets instead of square brackets
What is a linked list?
A linked list is a dynamic data structure used to hold an ordered set of items that are not stored in contiguous locations.
What is the name of an item in a linked list?
Nodes
What does each node in a linked list contain?
each node contains its data and the address of the next node
What is a stack?
A LIFO data structure where items can only be removed and added on the top of the stack
LIFO = Last in First out
Give an example of when a stack may be used
Back button in a web page