Unit 6 plus HL Flashcards

(20 cards)

1
Q

What is A collection

A

An ADT that hols elements of the same or different data type

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

Characteristics of a collection

A

Resizeable
has a set of methods that can be called on
stores multiple data of different types
only accessed sequentially
can have objects

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

What is a sub program

A

a small program with computer instructions within a larger program its purpose is to perform a specific task, this task may be used more than once in the main program

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

advantages of using sub program

A

breaks complex programming jobs into simpler jobs
distrubuting a large programming problem among various programmers
enables code reuse
improving maintainability and tracability
reducing programming code duplication

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

advantages of using a collection

A

reusability
modularity
reliability

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

what is code reuse

A

it is very useful as it allows programmers to take advantage of existing code to speed up their task

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

what are fundamental operations

A

the basic operations a computer performs(add compare retrieve store)

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

compound operations

A

a combination of fundamental operations

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

what is concurrent thinking

A

executing different instructions simultaneously by multiple processors

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

what is concurrent

A

something that happens at the same time as something else

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

pros and cons of concurrent thinking

A

better planning and coordination of resoureces
example is access to database by several users

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

what is a stack

A

an adt that stores elements in a particular order and only allows access to the last item inserted

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

what are the methods of a stack

A

push: pushes an item onto the stack
pop: returns and removes the last item inserted on the stack
isempty: checks if the stack is empty
size: checks the size of the stack
peek returns but does not remove teh item from the stack

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

characterists of a stack

A

last in first out
restricted access

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

applicaitons of stacks

A

undo button
tower of hanoi
reversing a word

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

what is a queue

A

an adt that stores elements in a particular order and only allows access to the front of the queue and the first item inserted

17
Q

methods of a queue

A

enqueue, puts an item in the back of the queue
dequeue, removes the first item inserted in the queue
isempty, checks if the queue is empty
size, checks the size of the queue
peek, returns but does not remove the first item in teh queue

18
Q

characteristics of a queue

A

restricted access
first in first out

19
Q

applications of a queue

A

printing tasks
keyboard input

20
Q

Explain the use of a one-dimensional array as a static stack. Your answer should include brief outlines of the push and pop operations and the tests for empty and full stacks.

A

An array A of N elements should be initialized,

keep track of the top of the stack since not all of the array holds stack elements (in an integer variable, for example, named TOP);

the main property of a stack is that stack values/objects go on and come off of the one end of the stack (LIFO data structure);

Push
Places a value (object) on the top of the stack;
Increase TOP by one and set A[TOP]= value;
Pop
Returns a value from the top of the stack and removes that value from the top of the stack;
Returns A[TOP] and decreases TOP by 1;
IsEmpty
Reports whether the stack is empty or not / returns True if the stack is empty, False otherwise;
Returns True if TOP is less than 0, False otherwise;
IsFull
Reports whether the stack is full or not/ returns True is stack is full, False otherwise;
Returns True if TOP is greater than N-1 (where N is size of the array), False otherwise;