2018 p1 Flashcards
represent 5 - 3 in RPN
5 3 -
represent 3 + 4 * 2 - 1 in RPN
3 4 2 * + 1 -
why is RPN used instead of infix notation ( e.g. of infix: 5 + 3)
simple for a computer to evaluate
simpler to code algorithm
how can a stack be used in the process of evaluating an expression in Reverse polish notation
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
two components of stack frame
local variables
parameters
Explain the circumstances in which it would be more
appropriate to use an adjacency list instead of an adjacency matrix.
when there are few edges between vertices
when edges are rarely changed
how do you know if a graph isnt a tree
if it contains a cycle
weighted graph
a graph where each edge has a weight
halting program
Determining if a program will halt
Why is it not possible to create a Turing machine that solves the Halting
problem?
there is no algorithm that solves a halting program
components of a turing machine
finite set of states
a set of transition rules
halting states
current state
universal turing machine
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.
Why can a Universal Turing Machine be considered to be more powerful than any
computer that you can purchase?
It has an infinite amount of memory