Basics Flashcards
define Algorithm
a step-by-step list of instructions for solving any instance of the problem that might arise
what does the word computable mean
A problem is computable if an algorithm exist for solving it
define Abstraction
Allows one to take a problem and separate them into logical processes
define Interface
functions that allow the user to interact with the system
Programming
is the process of taking algorithm and encoding it into a notation, a programming language, so that it can be executed by a computer. Without an algorithm there can be no program
Data Types
Data Types provide an interpretation for binary data so that we can think about the data in terms that make sense with respect to the problem being solved. Low level or primiative data types provide the building blocks for algorithm development
Abstract data type
a logical description of how the user views the data in that they are concerned with the allowed operations and used (its behaviour) of the data without regard to how the will to the implementation.
The Abstract data type is the shell the user interacts with. The implementation is hidden one level deeper
Data Structure
A data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data. The implementation of an abstract data type
Class
A class is a code template for creating objects. They are analogous to data types in that the user of a class only sees the state and behavior of a data item.
Functionalities of a class are defined by setting attributes, which acts as containers for data and methods (aka functions) related to those attributes.
Objects are created or instantiated from a class or done so through a subroutine called a constructor
Classes are a description of what the data looks like (the state) and what the data can do (the behavior)
List (Python)
A list is an ordered collection of zero or more references to Python data objects. They are heterogeneous meaning that there members do not need to belong to the same class.
Lists are mutable, meaning they can be modified.
in Python a list is given by var = [obj1, obj2, …]
range (Python)
A function that produces a range object that represents a sequence of characters.
Strings (Python)
Strings are sequential collections of zero of more letters, numbers and other symbols.
Strings are immutable, meaning they cannot be modified
Tuples (Python)
Very similar to list in that the are heterogeneous sequences of data. The differences is that a tuple is immutable, like a string.
However, because they are immutable, Python allocates larger blocks of memory with lower overhead. This means Tuples can be faster to work with as compared to Lists
in Python a tuple is given by var = (obj1, obj2, …)
set( ) (Python)
A set is an unordered collection of zero or more immutable Python data objects. The empty set is represented by “set( )”. Sets are heterogeneous, and the collection ca be assigned to a variable as below
in Python a set is given by var = {obj1, obj2, …}
dictionary (Python data structure)
A dictionary is an unordered structure that contains a key-value pair are are typically written as key:value.
Ex: phone_ext = {‘david’ : 1137, ‘brad’ : 1212, … : …}