Basics Flashcards

1
Q

define Algorithm

A

a step-by-step list of instructions for solving any instance of the problem that might arise

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what does the word computable mean

A

A problem is computable if an algorithm exist for solving it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

define Abstraction

A

Allows one to take a problem and separate them into logical processes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

define Interface

A

functions that allow the user to interact with the system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Programming

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Data Types

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Abstract data type

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Data Structure

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Class

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

List (Python)

A

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, …]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

range (Python)

A

A function that produces a range object that represents a sequence of characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Strings (Python)

A

Strings are sequential collections of zero of more letters, numbers and other symbols.

Strings are immutable, meaning they cannot be modified

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Tuples (Python)

A

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, …)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

set( ) (Python)

A

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, …}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

dictionary (Python data structure)

A

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, … : …}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

control structures

A

think of iteration and selection. These options allow the programmer to choose the statement that is the most useful for the given circumstance.

Examples include “while” and “for” statements

17
Q

list comprehension

A

a list comprehension allows one to create a list based on some processing or selection criteria.

18
Q

shallow equality

A

if the two variables reference the same object.

19
Q

deep equality

A

if two variables reference different objects but both have the same value

20
Q

Define the term Loop Invariant for a set or array of values.

A

The values of an array do not in a loop although their indices may change. We need to show three things:

1) it is true prior to the first iteration
2) it remains true before the next iteration
3) when the loop terminates, the invariant gives us a useful property to show the algorithm is correct