MIDTERM Flashcards

1
Q

What should the vocabulary of pseudocode be?

A

Problem Domain

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

What is another word for list?

A

Collection

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

What kind of list is an array?

A

Linear List

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

What kind of data structure is Last In, First Out?

A

Stacks

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

What end of a stack do removals happen?

A

Head

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

What end of a stack do additions happen?

A

Head

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

What is it called when a stack is full?

A

an Overflow State

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

What operations does a stack have?

A
  1. Push
  2. Pop
  3. Peek
  4. isFull
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a linked list?

A

A collection of nodes

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

What does a node consist of?

A

Data and pointer(s)

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

How many pointers are held in a node for a stack?

A

One: Pointer to next

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

What is it called when moving from one node to another by following a next reference?

A

Link Hopping, or Pointer Hopping

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

What is the first node in a list called?

A

Head

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

What is the last node in a list called?

A

Tail

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

What direction can a singly linked list be traversed?

A

From head to tail

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

What is the difference between a singly linked list and a doubly linked list?

A

Pointer to previous

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

What end of a queue do additions happen?

A

Tail

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

What end of a queue do removals happen?

A

Head

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

What kind of data structure is First in, First out?

20
Q

What operations does a queue have?

A
  1. Clear
  2. Enqueue
  3. Dequeue
  4. Peek
  5. isEmpty
21
Q

How is a priority queue different from a queue?

A

Removals based on priority, not first in first out

22
Q

How must priority be stored for a priority queue?

23
Q

What are some operations that are different for a priority queue?

A

insert_with_priority
pull_highest_priority

24
Q

Which algorithm only sorts the array if necessary?

A

Insertion sort

25
On which pass will an insertion sort algorithm consider the whole array?
Last pass
26
Which algorithm places the largest element in it's position after the first pass?
Bubble Sort
27
Which algorithm finds the smallest element and places it in it's final position on each pass?
Selection Sort
28
How is information for a function call stored in memory?
Dynamically on the runtime stack
29
What information is saved about a function?
Variables, parameter values, and return address
30
What is the function call information called in memory?
Activation Record or Stack Frame
31
How long does an activation record exist in memory?
As long as the function owning it is executing
32
Which activation record outlives every other one?
main()
33
What is the name of the last recursive call?
The Anchor
34
What is the purpose of the anchor?
Ensures we don't fall into an infinite loop
35
What are the 3 types of recursion?
1. Linear 2. Binary 3. Multiple
36
Which two algorithms use the divide and conquer approach?
Merge and QuickSort
37
Which algorithm uses a pivot?
QuickSort
38
How many subsets does QuickSort use?
3
39
What is the acronym for the subsets of a QuickSort?
L.E.G. Less than Equal to Greater than
40
How is the type of data specified for a generic function or class?
A Parameter
41
What are the two types of templates?
1. Function 2. Class
42
What is the format for a template function definition?
template < typename T > returnType function_name(parameter list)
43
What is it called when the compiler creates a specific version of a generic function?
Specialization or Generated Function or Instantiating a function
44
What is the format for a generic class declaration?
template < typename T > class className {}
45
How do you instantiate an instance of a generic class?
className< dataType > obj;