2018 p1 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

represent 5 - 3 in RPN

A

5 3 -

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

represent 3 + 4 * 2 - 1 in RPN

A

3 4 2 * + 1 -

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

why is RPN used instead of infix notation ( e.g. of infix: 5 + 3)

A

simple for a computer to evaluate
simpler to code algorithm

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

how can a stack be used in the process of evaluating an expression in Reverse polish notation

A

from LHS push values onto stack
each time operator reached pop two values off the stack and apply operator to them
add result to stack

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

two components of stack frame

A

local variables
parameters

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

Explain the circumstances in which it would be more
appropriate to use an adjacency list instead of an adjacency matrix.

A

when there are few edges between vertices
when edges are rarely changed

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

how do you know if a graph isnt a tree

A

if it contains a cycle

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

weighted graph

A

a graph where each edge has a weight

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

halting program

A

Determining if a program will halt

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

Why is it not possible to create a Turing machine that solves the Halting
problem?

A

there is no algorithm that solves a halting program

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

components of a turing machine

A

finite set of states
a set of transition rules
halting states
current state

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

universal turing machine

A

a turing machine that can execute.
it has the ability to read input from a tape, process information based on a given program, and produce output on the same tape.

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

Why can a Universal Turing Machine be considered to be more powerful than any
computer that you can purchase?

A

It has an infinite amount of memory

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