CC4 - chapter 1 and 2 Flashcards

1
Q

– machine that manipulates data.

A

Computer

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

–Concealing of the implementation details of data object from the outside world

A

Data encapsulation / information hiding

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

– separation between specification of a data object and its implementation

A

Data abstraction

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

– a collection of objects and set of operations that act on those objects

A

Data type

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

– storing and organizing data in a computer so that it can be used efficiently.

A

Data structure

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

– may be organized in many different

A

Data

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

CHARACTERISTICS OF ALGORITHM

A
  • Provides description of elements in terms of data types
  • Defines the relationship among individual
    Elements
  • Valid operations and parameters to be passed
  • Error conditions associated with the operations
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

DATA STRUCTURE OPERATIONS

A
  • traversing
  • searching
  • inserting
  • deleting
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

– accessing each record exactly once so that certain items in the record may be processed.

A

Traversing – retrieving/visiting

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

– finding the location of the record

A

Searching – insert

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

– adding new records to the structure.

A

Inserting – update

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

– removing

A

Deleting – remove

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

– used by os, Compilers, dbms, data communications

A

data structure/+ algorithms

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

– its elements form a sequence
- Array
- Stack – lifo
- Queue – fifo
- Linked list

A

Linear data structure

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

– represent data containing a hierarchical relationship between elements
- Tree & graph

A

Non-linear data structure

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

Quick insertion, very fast access if
Slow search, Slow deletion, index is known, Fixed size

A

Arrays

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

Quicker search than unsorted array. Slow insertion and deletion, Fixed size

A

Ordered Array

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

Provides last-in first-out access Slow access to other items

A

Stack

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

Provides first-in first-out access Slow access to other items

A

Queue

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

Quick insertion and quick deletion Slow search

A

Linked List

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

Quick search, insertion and Deletion algorithm is deletion if tree remains balance complex.

A

Binary Trees

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

Very fast access if key known, Fast Slow deletion, access slow if key not known, inefficient memory usage

A

Hash Table

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

Fast insertion, deletion. Access to Slow access to other items

A

Heap

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

Models real world situation Some algorithms are slow access.

A

Graph

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Algorithm – finite set of instructions that takes some raw data as input and transforms it in to refined data.
**Algorithm**
26
**ALGORITHM STEPS**
* input * output * definiteness * finiteness * effectiveness
27
– zero or more quantities are externally supplied
**Input**
28
– at least one quantity is produced
**Output**
29
– each instruction is clear and unambiguous
**Definiteness**
30
– algorithm terminates after a fi nite number of steps
**Finiteness**
31
– every instruction must be basic enough to be carried out
**Effectiveness**
32
**COMMON TYPES OF ALGORITHM**
* searching * sorting * compression * fast Fourier transforms * encoding * geometric * pattern matching * parsing
33
– search for a given item in large data collection
**Searching**
34
– arrange data items
**Sorting**
35
Compression – reduce the size of data and program files
**Compression**
36
– designed for digital signal processing
**Fast fourier transforms**
37
– encryption of data
**Encoding**
38
– identification of geometric shapes
**Geometric**
39
– comparing images and shapes
**Pattern matching**
40
– identify different programming constructs
**Parsing**
41
**CLASSIFICATION OF ALGORITHM**
* iterative * divide and conquer * greedy * back tracking
42
– repeated in loops until the goal is achieved
**Iterative**
43
– fragmented into subproblems which are solved partially
**Divide and conquer**
44
– an immediately available best solution at each step is chosen
**Greedy**
45
– all possible solutions are explored
**Back tracking**
46
**EXPRESSING AN ALGORITHM**
* natural language * graphic representations * programming language
47
– must be well defined and unambiguous
**Natural language**
48
– flowcharts
**Graphic representations**
49
– low level implementation must be removed and replaced by natural language
**Programming language**
50
- Limitation of recursion (only factorials, ackermann, fibonacci, …)? - A tool for theorician? - Theorem: ‘’any program that can be written using assignment, th - E ifelse statement and the while statement can also be written using assignment, if-else and recursion.’’ - Example: Fibonacci – f(0)=f(1)=1 – f(n) = f(n1) + f(n2)
**Recursive algorithm**
51
- Stated as a function relating the length to the number of steps - Is the time and space it uses
**Complexity**
52
**2 CRITERIA FOR PERFORMANCE ANALYSIS**
* space complexity * time complexity
53
– the amount of memory needed by a program to run to completion
**Space complexity**
54
– the amount of computer time needed by a progra m to run to completion
**Time complexity**
55
**TWO PHASES IN PERFORMANCE EVALUATION**
* performance analysis * performance measurement
56
– priori estimate
**Performance analysis**
57
– priori testing fixed
**Performance measurement**
58
part – independent. Memory does not change
**variable**
59
part – dependent. Memory do change
**asymptotic**
60
– helps to compare algorithms worst case running
**notation**
61
– way of solving a problem or calculation in less time by using more storage space (or memory), or by solving a problem in very little space by spending a longtime.
**Time-space tradeoff**
62
– is a finite, ordered sequence of data itemsknown as elements.
**List**
63
– each element has a positionin the list.
**“ordered”**
64
– number of elements currently stored
**Length of the list**
65
T/F: There are two standard approaches to implementing lists, the arraybased list, and the linked list.
**true**
66
T/F: - The beginning of the list is called the tail, and the end of the list is called the Head.
**false (baligtad)**
67
– it is a collection of homogenous, Ordered andfinite set of elements. It is a linear data structure. Its data type can be primitive, composite or other data types.
**Array**
68
– same element type and have the same structure
**Homogenous**
69
– organized in sequence.
**Ordered**
70
– fixed number of elements.
**Finite**
71
**ADVANTAGES OF AN ARRAY**
- An array uses a single variable to Represent a large set of homogenous data collection. - An array provides direct access to a storage address for an element. Therefore, retrieval of an element is extremely fast. - The elements on an array can be Manipulated easily using an index. Thus, processing of array is flexible. - It is easy to create and initialize an array. Arrays are good at implementing iterative algorithms. - Multi-dimensional arrays facilitate grouping of data collection into hierarchical structure
72
**ACCESSING ARRAY**
* index * index set * lower/upper bound * array name/index *bracket notation
73
– array the position of an element
**Index**
74
– range of values for the index
Index set
75
– smallest and largest value in of index
**Lower and upper bound**
76
– individual elements of an array
**Array name and array index**
77
**DISADVANTAGES OF AN ARRAY**
- Array size cannot be increased or decreased during runtime. - Insertion and deletion operations on arrays are not efficient. - For very large data sets, the program may run out of the storage space
78
**ARRAY OPERATION**
* retrieving * adding * deleting * inserting * traversing
79
– -it is also called accessing
**Retrieving ** *- To retrieve an element we must know the index value*
80
– inserts new element in a position specified by the index - aka assigning
**Adding**
81
– deleting operation removes an existing element with the given index.
**Deleting**
82
– it adds new element in a specified position, without replacing any existing element the position is specified in terms of index value or position relative to an existing element.
**Inserting**
83
– involves accessing and processing an array element exactly once - aka visiting
**Traversing**
84
- Two-dimension arrays can be used to store and process strings - A string is a sequence of characters - In c/c++, a string contains a null terminating character - In several applications, we need to store a group of related strings - 2-d arrays provide a convenient and - Simple mechanism for storing elements - Since in 2-d arrays, all rows must have the same number ofharacters, storage space may be wasted if some of the - Strings have shorter lengths
**String arrays**