cs109 final

Ace your homework & exams now with Quizwiz!

Protocol - what does a layer in general do, why do we need layers of service?

A layer implements a service, using its own internal-layer actions and relying on services provided by the layer below Why do we need layering? (2): Explicit structure allows identification of the complex system's pieces Layers of services give us MODULARITY, and modularization eases maintenance and updating of the system

AI - what is an agent?

Agents/Intelligent agents: an autonomous entity which observes through sensors and acts upon an environment using actuators (i.e. it is an agent) and directs its activity towards achieving goals.

Is insertion sort good for lists that are already substantially sorted?

Yes. if the list is already sorted entirely, it runs in O(n) time.

In what kinds of games does Minimax work? What is A* based on? How does greedy best first search choose which node to explore? What algorithm would you use to search for the shortest path on a map? What algorithm WOULDN'T you use if you want to plan several moves ahead in a game of tic tac toe, and what algorithm would you use instead?

You can say their difference is the definition of their heuristic. Minimax's heuristic only works for turn-based games usually where one player is trying to maximize their own advantage while the opponent wants to minimize it. A* is based on using an admissible cost. Greedy best first chooses to start with looking at the immediate best nodes. Which algo. you choose to use would depend on which heuristic would makes more sense for the application you are applying to, e.g. searching for shortest path on a real map, you can use A* because the euclidean distance between nodes is a good admissible cost. For a game of tic tac toe, it is simple enough that minimax tree works well as seen from the assignment #4, but greedy best first probably won't work too well because you might want to plan ahead for your next moves.

Kruskal's complexity - another way of writing O(E log E)

You could also say O(E log V) because E is at most V * V. Log(V²) == 2 log(V), and 2 log(V) is O(log V). E == V*V when every vertex is connected to every other vertex: |E| <= |V|² . log |E| < log |V|² . log |E| < 2 log |V| . running time of MST-KRUSKAL is: O(E log V) Each isolated vertex is a separate component of the minimum spanning forest. If we ignore isolated vertices, we obtain V ≤ 2E, so log V == O(log E).

disadvantages of circuit switching (2)

ZERO ability for the circuit to be used by anything else while the circuit is still up. Need to know who you want to talk to, meaning there's no way to build a large, scalable network.

how many problems are not effectively computable? examples (2) could these problems be solveable one day?

an infinite number 1. Halting problem 2. A program that counts all the real numbers Maybe could be solveable one day, but not on a Turing computer Turing computers can ONLY SOLVE THINGS THAT ARE COMPUTABLE.

What problems can an turing machine solve?

any computational problem

define spanning tree

any tree that covers all the vertices of the graph

7 layers of the IPS

application (top), presentation, session, transport, network, link, physical

What programs need to be general

programs need to access a memory and to be able to control the order of instructions to execute based on the results of computation

Robotics - 4 control schemes

reactive, behavior-based, deliberative, hybrid

Which is true Weak AI describes an agent that acts as if it is intelligent Weak AI is a term used to describe an agent that is actually intelligence Both Neither

Weak AI describes an agent that acts as if it is intelligent

Storage is __ and __

Modular and hierarchical Storage is MODULAR: as long as the person who wants the file knows its address and as long as the storekeeper can file the file, doesn't matter how physical files are stored (or where they are stored, though it may take a little longer to get things from ram)

Process scheduling - first come, first serve: is it preemptive?

NON PREEMPTIVE Non-preemptive algorithms are designed so that once a process enters the running state, it cannot be preempted [[stopped]] until it completes its allotted time, whereas the preemptive scheduling is based on priority where a scheduler may preempt a low priority running process anytime when a high priority process enters into a ready state.

Open architecture meaning

Network has open architecture: designed to make adding, upgrading and swapping components easy.

network layer

Network layer: routing of datagrams from source to destination (make sure packets go on the link) (IP, routing protocols) Determines best route for transfer of data Fastest and most reliable Data has IP addresses of origin computer and server Routers are involved here

Can an FSM do this: Tell if a string is a palindrome

No

Can an FSM do this: Given a string of As and Bs of arbitrary length, tell if number of As and Bs are the same Does the string have the same number of As and Bs in an order Does it have the same number if all the As come before all the Bs Are there more As than Bs in the string Is the string a palindrome

No

Is Jacquard Loom a computer?

No It was an info transformer and could be programmed, but it did not have storage

Can FSMs count?

No. can't count arbitrarily or otherwise

Deep blue - describe its search trees, can it search in parallel

Nodes: positions Edges: legal moves Leaf nodes: end positions that need to be evaluated Each node gets a numeric evaluation score In deep blue search nodes: Leaf nodes that end in checkmate for the opponent are good Leaf nodes that don't end in checkmate need to be evaluated in some other way Each node gets a numeric evaluation score Deep blue evaluates a lot of nodes in parallel (at once).

Big topics in AI

1. Deciding what to do next Search over possibilities to see which succeed Deep Blue Create and execute plans Integrate knowledge about available actions 2. Reasoning about situations Knowledge representation Logical and probabilistic reasoning 3. Learning from experience and interactions with others Watson AlphaGo

Memory hierarchy

1. Registers - expensive but fast 2. Cache - small, fast memory between registers and RAM Keep things that are likely to be needed in future Recently accessed memory (temporal locality) Memory from nearby locations of something you just retrieved (spatial locality) RAM (memory; also known as primary storage) Same amount of time to access each location of RAM More RAM improves computer performance by reducing the number of time consuming reads and writers Disk/Secondary Storage

steps of compilation

1. Source code 2. Lexical analysis (Scanning): Identify logical pieces of the description Look at code to see if it looks like C code. *Break up the code into series of tokens.* 3. Syntax analysis (Parsing): Identify how the pieces relate to each other Analyze the code to see if it matches syntax of the language. *Parse the syntax tree.* Depth-first traversal: first generate the MST for first root child 4. Semantic analysis: Identify meaning of overall structure What data type goes with each "word" (< is bool, while is void, etc.) 5. IR Generation: Design one possible structure IR = internal representation Pseudocode for assembly language *#2 to #5 are MACHINE INDEPENDENT. * 6. IR Optimization: Simplify the intended structure 7. Code generation: Fabricate the structure Compiler looks for better ways to do things when they're optimizing 8. Code optimization: Improve the resulting structure #6 to #8 are MACHINE DEPENDENT. 9. Machine code

An unweighted, undirected graph has 5 vertices. What is the maximum number of edges this graph could have, assuming each edge connects two distinct vertices?:

10

how many steps of compilation?

9

What makes a computer?

A computer is an information transformer that NEEDS STORAGE. Need memory (store and retrieve info) AND branching/flow (be able to change course of execution based on info encountered during calculation) First three objects on slides are not capable of this

Robotics - actuators

A robot acts through its actuators (motors) which typically rive effectors (wheels). Robotic actuators are very different from biological ones, but both are used for: Locomotion (moving around) Manipulation (handling objects) → 2 areas of robots: mobile robotics manipulator robotics

A* search - how does it relate to best first search?, define admissible, what must the heuristic not do?

A* search best first with f = g + h For every node, the evaluation is a knowledge-plus-heuristic cost function f(x) to determine the order in which the search visits nodes Cost function is a sum of two functions: Past path-cost function, which is the known distance from the starting node to the current node x (g(x)) Future path-cost function An admissible heuristic estimate of the distance from x to the goal (h(x)) Admissible: h must not overestimate the distance to the goal Heuristic must underestimate or get exactly right the estimated distance bt current node and goal node. Returns optimal path. A* score = cost of path so far + heuristic to end node SEE THE DIAGRAM****

AI vs. ML

AI: actions An intelligent system (agent) choosing what to do in a smart way Use a body of knowledge and current inputs to make a reasoned decision about what action to take ML: data Analyze large amounts of data to discover patterns so predictions can be made when presented with new data

was the analytical engine a computer? difference engine?

Analytical engine was a computer but difference machine wasn't. Or was the analytical engine a computer (my notes say it had memory)

application layer

Application layer (TOP): supports network applications Closest to user experience

Binary search complexity

Binary search of a sorted list: O(log2(n)) It's log2n because you halve the elements on every iteration until you get to 1. Log2(n) is the maximum number of searches that are required to find something in a binary search. The average case involves log2(n)-1 searches. If unsorted, you have to sort the list FIRST, just once: NlogN (if you use quicksort). then you could do the actual binary search: log n. but n log n is greater than log n, so complexity would be n log n.

OS as glue

Bits of OS that make it easy to use and program Common services (copy/paste) Files can be read by any application US routines for look and feel Separate applications from hardware (so you don't need to know which keyboard, disk drive, etc.)

What is booting and ROM?

Booting and ROM (read-only memory)

BFS complexity

Breadth first traversal of a tree: O(V) BFT: starts at root and explores neighbor nodes first before moving to children Need to traverse all nodes → O(V) O(V+E) = O(b^d) The time complexity can be expressed as O(V+E) since every vertex and every edge will be explored in the worst case.

Process scheduling - shortest remaining time

Can be preemptive if there are new processes. (e.g. While running a process, a new process with shorter remaining time/higher priority is added to the queue and the CPU will switch to the new one)

How Jacquard Loom was programmed

Card sequence = program Each card = an instruction to the machine to do precisely one thing (put itself in a particular state) A sequence of cards causes the machine to step through a sequence of states. Weaver = programmer

What 3 aspects of a program does the OS care about

Cares about 1. What resources the process will need 2. How long will it run 3. How important is it

Component of internet - communication link

Communication links have a certain bandwidth (transmission rate) Ex: fiber, copper, radio, satellite

Tractable vs. intractable - knapsack problem

Complexity: 2^n No way to add all the combinations without adding them all Intractable? NP-hard Verifying the solution is EASY (polynomial time), but finding the solution is hard. The decision problem (can we get to a value V without exceeding weight W?) is NP-Complete. However, the optimization problem (what is the most value we can get for the least weight?) is NP-Hard.

Minimax algorithm

Computer assumes that both players make the best move. Computer plays W and maximizes score for W. Chooses child node with highest value if W needs to move. Chooses child node with lowest value if B is to move.

describe content provider network

Content provider network can make their own network which is made up of all of these parts. They would do this to bring services and content close to end users. CPNs often bypass tier-1 and regional ISPs.

Robotics - define control

Control: the way in which the sensing and action of a robot are coordinated.

Define core network and two things it does

Core network: connects local providers to one another (all equipment between two edge nodes??) Does two things: Routing: determines source-destination route taken by packets Forwarding: moves packets from router's input to appropriate router output

Game search trees - how to represent current state, what are leaf nodes

Current state in the game = root node Leaf nodes: end positions that need to be evaluated Each node gets a numeric evaluation score

If AI is about action, what is ML about?: Money Data Memory Planning

Data

Three big topics in AI are

Deciding what to do next, reasoning about situations, and learning from experience and interaction

Describe AlphaGo's deep neural networks

Deep neural networks Take description of Go board as input Process the description through 12 network layers containing neuron-like connections Policy network selects next move to play Value network predicts winner of game Training the neural network on moves from humans playing Go, AlphaGo could predict human's next move 57% of the time Learned to discover new strategies by playing a LOT of games between its neural networks and using reinforcement learning (adjusting connections in network)

Definition of intelligence

Definition of intelligence: common underlying capabilities that enable a system to be general, literate, rational, autonomous, and collaborative

DFS complexity

Depth first traversal of a tree: O(V) DFT: starts at root and explores children first. If there are no more children, move up one. Need to traverse all nodes → O(V)

Who designed principles of network architecture?

Designed acc to Kahn and Cerf: Every system on the Internet has a unique address in the same format. Minimalism, autonomy Best effort service model: Internet delivers on a BEST EFFORT basis. Stateless routers Decentralized control

Do Dijkstra's and Prim's make the same MST

Dijkstra's algorithm DOES NOT return the same MST as Prim's algorithm [[Dijkstra's algorithm finds the shortest path bt two nodes.]]

Djikstra's complexity

Dijkstra's algorithm to find the shortest path from a node in a graph to all other nodes: O(V^2) [[or online I found O(E log V)]]

Jacquard Loom is a __ state machine with __ kind of encoding; what kind of encoding is each isntruction?; therefore, the program is a sequence of __ __?

Discrete state machine The JL uses binary encoding (up or down) to encode the machine state, so machine state is a binary number. Each instruction is a binary number (since each instruction is the state the programmer wants the machine to be in). Program is a sequence of instructions, SO *the program is a sequence of binary numbers*.

Loom program limitations (4):

Does not scale because it would have LARGE INSTRUCTIONS--To program a big machine, you need big words (large state implied large instruction widths). Does not scale because no COUNTING--no repeats or loops to do things over a certain number of times. Does not scale due to no MODULARITY: No logical chunks for sub-paterns that can be reused without replication (no functions). No decision-making on the fly: No branching to do one thing instead of another based on a condition (If/then/else, no jumps/goto).

Robotics - external vs. internal state

External state: state of world; sensed using robot's sensors Ex: night, day, at home, sleeping, sunny Internal state: state of robot; sensed using internal sensors Stored/remembered Ex: velocity, mood Internal state can include past experience, so state is a combo of internal and external state.

Best first search - how are nodes evaluated?

Each node of the graph is coed according to a heuristic Heuristic: guess based on some estimate

OS as illusionist

Each program thinks it's running separately Each program thinks it has full acess to computer's resources

Summary of network of networks

End systems => Access nets/Access ISPs => Larger ISPs (or regional nets => larger ISPs) => IXP (internet exchange points) => Tier1 ISP (or content provider network)

What do end systems connect to? and on and on until the highest level

End systems connect to Internet using access ISPs (internet service providers) Access ISPs are interconnected through 1 of two ways: Through larger ISPs Through regional nets which connect a bunch of access nets together and then feed into larger ISPs Larger ISPs are connected through Internet exchange points. Larger ISPs can connect to each other through peering links. then these meet in tier1 ISPs or concent provider networks

Tractable vs. intractable - enumerating permutations

Enumerating permutations: how many different permutations are there for a list of n numbers? O(n!) Definitely intractable

Greedy best first search

Evaluation function is a heuristic that attempts to predict how close the end of a path is to a solution Paths that are judged to be closer to a solution are extended first

DFS on graphs

Explore all children of a node; if there are no more children, then go up one level and look for another string of children. Practice: see midterm and assignment 12 problems.

BFS on graphs

Explore all siblings of a node before children Practice: see midterm and assignment 12 problems.

first high level language

FORTRAN (formula translation): first HLL Compiler developments were driven by the need to optimize FORTRAN

5 aspects of an AI agent (good little rabbits ate carrots)

GENERALITY: capabilities of a specific agent, scope of goals and capabilities usable for them Can the agent play both chess and tennis, or solve math problems and drive a car, or perform full scope of adult human tasks? LITERACY: extent of knowledge available to the agent Ignorance by itself is not lack of intelligence RATIONALITY: Making the best decisions about what to do, given goals, knowledge, and capabilities Irrationality can be programmed for creativity. AUTONOMY: operating without assistance COLLABORATION: working well with others

Halting problem, what class of the 4 classes is it in

Halting problem: UNDECIDABLE Turing proved no algorithm exists that always correctly decides whether, for a given arbitrary program and input, the program halts when run with that input. The essence of Turing's proof is that any such algorithm can be made to contradict itself and therefore cannot be correct. When you feed H+ into itself, you ask the question "does H+ halt when given input H+?" If H+ DOES halt, you get "Yes" as the answer, but then it loops forever → so it does halt If H+ doesn't htalt, you get a "No" answer, but then it halts If it DOES halt, then it doesn't halt. If it doesn't halt, then it does halt. Paradox Started off with the assumption that we can solve the problem, but ended up with a paradox → so assumption was wrong, meaning that there is no problem that can solve halting problem.

Halting problem

Halting problem: a program that determines if another problem will halt (terminate) on arbitrary input 1936: Turing proved that a general algorithm to the halting problem for all possible programs over all possible inputs cannot exist. Halting problem is undecidable. A general version of halter (one that works for all programs and their inputs) does not exist. To decide if a program A halts on input a, need to write a program called "halter". Inputs: A, a Output: Yes (if program A halts on input a) or No halter(A,a) If (some computation) is true Return Yes Else Return No Proof by contradiction: Assumption: a general version of halter exists This assumption leads to a contraction clever(program, input) Result = halter(program,input) If result is No, return yes // if halter says yes, clever halts. Else, loop forever When clever is given itself as input If halter says that clever halts, then clever loops forever (so it doesn't halt) [[BP1]] If halter says that clever does not halt, then clever halts and returns Yes Conclusion: halter cannot exist because of BP1

AI - systems of interest (3)

Have goals to achieve Internal or external situations Endogenous (internal cause or origin) or exogenous goals (developing from external factors) Have capabilities to perceive and act in service of their goals Such as eyes, ears, hands, legs OR wheels, laser range finders, etc. Can embody knowledge concerning their goals, capabilities, and situations

How Access nets are NOT connected

How they are not connected: NOT interconnected by connecting each ISP to every other ISP bc not scaleable (O(n^2) connections). NOT connected through one global ISP due to competition (it's a business).

What did we learn from AlphaGo about how quickly humans vs. machines learn?

Human: good game play without extensive training Machine: better than human player with a lot more training and essentially infinite recall

How pigeonhole principle applies to FSMs

If a FSM with n states is given n+1 symbols, it will revisit one state at least once

How many spanning trees could a graph have?

If a graph is a complete graph with n vertices, then total number of spanning trees is n^(n-2) where n is the number of nodes in the graph.

if all the edge weights of a graph are the same, then how many spanning trees of the graph are MSTs?

If all the edge weights of a given graph are the same, then every spanning tree of that graph is minimum. If edges can have equal weights, the minimum spanning tree may not be unique.

Kruskal's complexity - if edges are sorted or not sorted

If the edges are already sorted: O(E) The E comes from checking for no loops as you build up the MST from the sorted list If the edges are not already sorted: O(E log E) The E log E comes from sorting (and you only have to sort once, so +). you can sort with quicksort. There is also + E work of checking for no loops as you build the MST, but that is a "constant" so it doesn't matter in Big O.

Quicksort complexity - worst case

If you *pick the biggest or smallest item as the pivot*, then there will be n splits and n work at each level (to find max/min value), which means O(n^2). When picking the biggest/smallest value, the list gets split into two lists of sizes 0 and n − 1 → n splits. If this happens repeatedly in every partition, then each recursive call processes a list of size one less than the previous list. Consequently, we can make n − 1 nested calls before we reach a list of size 1 If you choose leftmost element always and you sort an already sorted array, you get worst case behavior → O(n^2). ******The worst case of quicksort comes from when one list have no element while the other one have the remaining elements, then the list decrease in size at a linear rate! So O(n) iterations will be needed.(giving O(n^2) because each iteration takes O(n) work).******

Best first search algorithm

If you label the nodes with scoring info about which are better than others, then the way to the play the game is to pick the best choice. OPEN = [initial state] CLOED = [] While OPEN is not empty, do: Remove best node from OPEN, call it n, add it to CLOSED If n is the goal state, backtrace path to n (through recorded parents) and return path Create n's successors For each successor, do: If it is not in CLOSED and not in OPEN, evaluate it, add it to OPEN, and record its parent Otherwise, if this new path is better than previous one, change its recorded parent. If it is not in OPEN, add it to OPEN. Otherwise, adjust its priority in OPEN using this new evaluation.

Minimax - if you want to look ahead d moves, you have to look through __ moves

If you want to look ahead d moves, you have to look though b^d moves B = # of times the game branches (so like how many open spaces there are in tic-tac-toe) D = depth (how far from that node you want to go)

Process scheduling - preemptive vs. non

In a non-preemptive policy once a process is scheduled on the CPU it runs until finished. In a preemptive policy the OS can pause (preempt) the process to allow other processes to use the CPU.

How many uncomputable problems are there?

Infinite number

Computer architecture - von Neumann architecture

Input which feeds into controller and ALU Output which feeds into controller and ALU Controller and ALU (CPU) which share a connection with each other as well as memory, input, and output Memory which is connected to controller and ALU Disk attached to memory but farther from CPU CACHE OUTSIDE CPU

who controls the internet?

Internet has NO GLOBAL CONTROLLER. Systems are peers; do not command each other.

Internet vs. World Wide Web - are they both networks?

Internet is a NETWORK; World wide web is a NETWORK APPLICATION.

Define finite state machine

It is an abstract machine that can be in exactly one of a finite number of states at any given time. FSMs have a fixed number of states. States = circles Transition = arrow

Example of a Jacquard Loom program (see lecture 1, slide 36)--how is the machine's state and each instruction captured? How wide is the state and each instruction? How long is the program?:

It's a 9x9 grid, with holes punched in an X formation. Machine state is captured in a 9-bit word Each instruction in the program is a 9-bit word State and each instruction is 9 bits WIDE The program is 9 instructions LONG.

OS - what does the kernel do

Kernel: core of an OS kernel coordinates other programs privileged access kernel runs until some other program needs to use CPU Principle of least privilege: kernel has highest privilege Does the OS care about what each program does or what it needs?:

5 kinds of access network

Kinds of access network: Digital subscriber line - uses an existing telephone line Cable network: can get slow if many people accessing at once Home network: Enterprise access networks (ETHERNET): end systems typically connect into ethernet Wireless access networks: shared wireless access network connects end systems to a router (through an access point)

Practice number representations and bases

Know how to convert BINARY, HEXADECIMAL, BASE 10 Instead of using a hexadecimal chart you can convert from binary to decimal and from decimal to hexadecimal. Memorize is that 10-15 = A-F. ---- Converting from binary to base 10, from base 10 to binary

Kruskal's compelxity

Kruskal's algorithm to find the MST of a graph: O(E log E) [[if edges aren't already sorted]]

Russell's Paradox

Let R be the set of all sets that are not members of themselves If R is not a member of itself, then its definition dictates that it must contain itself, and if it contains itself, then it contradicts its own definition as the set of all sets that are not members of themselves.

link layer

Link layer: data transfer between neighboring network elements (Ethernet, 802.111 (Wifi), PPP) Layer that your NICs are on Checks for error in data

define MST; how many can a graph have?

MST: tree of minimum edge cost If the edge weights are all positive, it suffices to define the MST as the subgraph with minimal total weight that connects all the vertices. If not all edges are positive, then the MST is the subgraph that connects all the vertices for a total weight closest to 0. A graph may have multiple MSTs For there to be the possibility of multiple MSTs, at least two edges in the graph must be equal

Which is true IBM Deep Blue was built using software that models the human brain IBM Deep Blue beat a human grandmaster at chess because unlike previous chess playing programs it did not use game tree search IBM Deep Blue was able to analyze somewhat fewer moves than a typical human grandmaster in a comparable period of time None of the above

None?

Order of Big Os

O(1) O(log n) O(n) O(n log n) O(n^2) O(n^c) → polynomial O(c^n) → exponential O(n!) → factorial

Prim's complexity

O(V^2) [[if you don't keep the vertices of the graph in some readily sorted order]] O(V^2) happens when you use an adjacency list graph representation that searches an array of weights to find the minimum weight to add. O(E log E) [[if edges are ordered by their weight]]. O(E log E) is the worst-case running time when you use a heap to store all edges of the input graph. To do this, you would use a heap to implement finding minimum weight edges in the algorithm's inner loop. can reduce to O(E log V)

Quicksort complexity - best case

O(n log n) [[best--median is chosen as pivot]] If you choose your pivot well (it's the median value), then You're always splitting in half, so split log n times. Each level processes at most n elements, so total amount of work done on average is the product O(n log n) [[Do n operations to find the median in EACH split]] If you choose RANDOM pivot or MIDDLE of the partition OR MEDIAN OF THREE (the median of the middle, first, and last element of the partition) Median of three fixes the problem of sorted and reverse sorted input and gives a better idea of the optimal pivot (the true median) Random pivot: n log n Median of three pivot: n log n ******The best case of quicksort comes from the two lists being of equal size every time, as the size of both list would then be half of the original list for every iteration, meaning only O(log n) iterations are needed. (giving O(n log n) because each iteration takes O(n) work).******

Insertion sort complexity - average

O(n^2) Average: also O(n^2) So IS isn't good for large arrays, but it's faster than quicksort for small arrays. The maximum number of comparisons for an insertion sort is the sum of the first n−1 integers. Again, this is O(n^2).

Robotics - 5 kinds of state

Observable: robot always knows its state Hidden/inaccessible/unobservable: robot never knows its state Partially observable: robot knows part of its state Discrete: like up, down, blue, red Continuous: when the robot is moving and then it has to take a sample of it's speed

Kruskal's algorithm

Order the edges in ascending order and add next edge (lowest cost) to the tree without creating a loop Repeat until you have V-1 edges in the tree.

define P, NP; example of NP

P (deterministic polynomial): set of problems that can be solved in polynomial time NP (nondeterministic polynomial): set of problems for which a solution can be checked in polynomial time Like subset sum problem If you give me a solution, I can easily check if the solution is correct using a polynomial time algorithm But you can't SOLVE for a solution in polynomial time

Component of internet - packet switch

Packet switches: forward packets Ex: routers and switches Router: packet switch that combines two networks Access point: wifi device that gives connectivity to wireless clients Access point CAN be a router

physical layer

Physical layer: bits on the wire (get bits from one side to another Any electric signals Cable, fiber optics, etc.

Quicksort algorithm

Pick a middle element in the sequence (pivot) Put all elements smaller than the pivot on its left Put all elements larger than the pivot on the right Now you have two smaller sorting problems Sort the left sequence using Quicksort Sort the right sequence using Quicksort Quicksort returns when the list of the sequence is 1 Also, when the list is of length 2, it returns if the two elements are in the right order, or it returns if the two elements are in the wrong order and then swapped.

Pigeonhole principle

Pigeonhole principle: If you have n pigeons and m pigeonholes, and n > m, then there is a pigeonhole with multiple pigeons.

Process scheduling for planes taking off

Planes taking off: FCFS If several small planes in line before large one, not efficient for average passenger

OS - define policies

Policies: set of rules that are given by the algorithm to help us share the resources/to enforce prioritization Rules enforced by algorithms that share access to resources. OS develops write policies that achieve some set of goals for the oeprating systems.

presentation layer

Presentation layer: allows applications to interpret meaning of data (encryption, compression, machine-specific conventions) OS works on this layer Converts text understandable to user to a form that computers understand Encrypts data

Process scheduling - priority based

Preset priority for each process Processes with higher priorities are carried out first, whereas tasks with equal priorities are carried out on a first-come-first-served (FCFS) or round robin basis. Can be preemptive if there are new processes. (e.g. While running a process, a new process with shorter remaining time/higher priority is added to the queue and the CPU will switch to the new one)

Prim's complexity

Prim's algorithm to find the MST of a graph: O(V^2) For each vertex (and there are V vertices), you have to search the list of edge weights each time to find the minimum edge weight (V searches for each vertex). → V^2 Sorting the edges doesn't completely help because we don't need the minimum edge, we need the minimum edge that grows the tree. There are data structures like heaps that can help us do this and then we get the run-time down to O(E log V)

Relationship between P and NP

Problems in P are also in NP But there may be some problems in NP which are not in P So, the question is does P = NP? All problems in P are easy to solve AND check and problems in NP are only easy not check, not solve.

OS as referee

Protection against other applications Crash in one program shouldn't crash OS or other programs Enforce fair resource sharing (why an infinite loop doesn't require a reboot) When a user program needs access to protected resources, they make a SYSTEM CALL.

Networks - define protocol, end-to-end protocol

Protocol: set of rules for packaging up and exchanging info; define the way that two things on the internet should talk to each other Humans and networks have protocols. End-to-end protocol: one you address your package, your job is done (some other service will handle processing and delivering of your package)

Process scheduling - how the 4 schedules rank in terms of utilization

RR - good FCFS - good SRT - good FP - good

What process schedules could have starvation and which doesn't?

RR - no starvation STR - could have starvation

Process scheduling - how the 4 schedules rank in terms of latency

RR - potentially high FCFS - hard to measure SRT - potentially high FP - ?

Process scheduling - how the 4 schedules rank in terms of throughput

RR - variable FCFS - variable SRT - high FP - ?

Process scheduling - how the 4 schedules rank in terms of fairness

RR - yes, no starvation FCFS - yes SRT - no, could have starvation FP - ?

Robotics - reactive control

Reactive control: Don't think, react Fast Reaction to specific input is predetermined

Typical controller tasks (5)

Read an instruction from memory Direct ALU to do some arithmetic or logic operation Transfer data from one place to another Prepare for the next instruction to be read Send a directive to input or output device

Why program in high level language?

Readable, understandable, possible Provides abstraction Provide a full compile/execution stack: Code → assembly → machine code Code → byte code → VM → machine code

4 design criteria of OS

Reliability and availability, security and privacy, performance, portability

OS - define resources, what are they (3)

Resources: some part of the computer that programs use, like memory, CPU, I/O devices OS manages resources: 1. Space (memory, such as virtual memory) 2. Time (CPU compute time--threads and processes) 3. Peripherals (input and output--abstractions, interrupts)

4 process schedules

Round robin, FCFS, priority based, shortest remaining time

Process scheduling - Round robin

Round-robin Preemptive Every process gets a set people of time to run.

what is a router? access point?

Router: Receive info from hosts or other routers and send it on, using info encoded in an address to choose where to send a message next.A router is a packet switch that combines two networks. Access point: a wi-fi device that gives connectivity to wireless clients.

Selection sort complexity

Selection sort: O(n^2) Algorithm: Go through the list starting at the beginning and find the smallest number Swap the smallest number with the number at location 1 March down the list starting at the second location and find the smallest number Swap the smallest number with the number at location 2

Robotics - state What provides state? Is state fully observable?

Sensor doesn't provide complete state Sensor gives data and must determine what data means There can be error in sensors, so robot-determined state differs from actual state Robots are basically all partially observable bc they can't sense everything?

Robotics - sensors

Sensor space/perceptual space: all possible values of sensory readings Robot exists in this space

session layer

Session layer: synchronization, checkpointing, recovery of data exchange A SESSION is a convo bt two computers Starts and ends sessions bt computer and server Gets data from a website

Shakey - what kind of CONTROL? it was the first robot to be able to __ __ __ __. what kind of search was designed for Shakey? Shakey's technology is like what we use everyday when we use __ __.

Shakey == planning First general-purpose mobile robot able to reason about its own actions Could analyze each human command and break it down into basic chunks autonomously (a PLANNING process) First mobile intelligent robot SRI International Self-driving cars, military drones A* SEARCH designed for Shakey -- like getting car directions today

why do we need an OS?

So that multiple programs can be running OS makes it efficient to share CPU, memory, disk, I/O between programs and users. The OS is the executive manager: starts, runs, pauses, restarts, and ends other programs. [[Enforce policies to manage/regulate the sharing of resources]]

Prim's algorithm

Start the tree with ANY NODE, chosen arbitrarily from the graph. Greedily grow the tree by one edge: of the edges that connect the tree to vertices not yet in the tree, find the minimum-weight edge, and transfer it to the tree. Repeat step 2 (until all vertices are in the tree). [[OR: Start with any vertex as a single-vertex tree; then add V-1 edges to it, always taking next (coloring black) the minimum-weight edge that connects a vertex on the tree to a vertex not yet on the tree.]]

Robotics - define state

State: a sufficient description of the system

Define state, a state representation should be __ and __, define discrete:

State: condition of a system at a point in time Pattern of raised and lowered threads is called the state of the machine. A state representation should be parsimonious (small descriptor of what the machine is going at any give time) and adequate (big enough to capture everything interesting about the machine). Discrete: modelled as proceeding in steps/finite chunks, indiivdually separate and distinct

Kind of organization for storage

Storage uses linear organization Each stored item has a number (an address) To retrieve an item, you have to know its address

Implications of defining computers in terms of functionality (3)

Strips away ancillary attributes previously thought to be essential Machine, electronic, speed, explicit programmability.. Enables appreciating the full scope of computers and computing Facilitates recognition of natural computers

T or F: All locations in RAM are on average equally slow or fast in terms of access speed

T

T or F: with FSMs, NO WAY TO TELL IF THE REVISITED STATE IS VISITED FOR THE 1ST TIME OR 5TH TIME

T

What does a compiler take in? what does it output?

Takes in a high-level language and produces something lower level, like assembly, byte code or machine code. Takes a program in one lang as input and produces a program in another lang as output

is a* search a kind of best first search? is it a greedy best first search?

The A* search algorithm is an example of best-first search. NOT a greedy best-first search as it incorporates the distance from start in addition to estimated distances to the goal.

Best first search - difference between best first and BFS/DFS

The only difference between best-first search and BFS/DFS is the fact that is is implemented with the priority queue data structure instead of a normal queue. This way, the "cost" or "closest path" is taken into consideration when determining which edge to explore first.

What storage do FSMs have?

The only storage it has is for the current state.

Robotics - hybrid control

Think and act independently, in parallel Parallel processes Mix of deliberative and reactive Self-driving cars are hybrid (mix of deliberative and reactive)

Robotics - deliberative control

Think hard, act later Slower

Robotics - behavior-based control

Think the way you act Focuses on robots that are able to exhibit complex-appearing behaviors despite little internal variable state to model its immediate environment React to environment based on learning from experience; behavior is based on CURRENT SET OF POSSIBLE BEHAVIORS AND EXPERIENCE

Control scheme tradeoffs of more/less thinking and more/less reaction

Thinking is slow But reaction must be fast Thinking enables looking ahead (planning) to avoid bad situations But thinking too long can be dangerous (falling off a cliff or being run over) To think, robot needs a lot of accurate info (world models), which make thinking even slower.

describe tier 1 ISP

Tier-1 commercial ISPs: has other lower tier ISPs and CPNs as customers Transit free A Tier 1 network is an Internet Protocol (IP) network that can reach every other network on the Internet solely via settlement-free interconnection, also known as settlement-free peering.

Time and space complexity

Time complexity: how long it takes the algorithm to run Space complexity: how much memory the algorithm needs

transmission control protocol (TCP)

To send info between 2 hosts, TCP sets up a communication session for the exchange Reliable: Ensures that messages arrive in order (can rearrange them) No errors, losses, or duplication of info Manages congestion to avoid network overload Relies on services of IP

Tortoise robots - what kind of control????

Tortoise robots == reactive, autonomous Bump into something → change direction Respond to light and touch in lifelike manner See out of a photoelectric cell Moves toward light If anything brushes against her as she moves toward light, she moves Each robot had two simulated neurons, sufficient for them to display complex behavior. First real world demonstration of artificial life.

3 problems that are tractable

Tractable problems include (3): Sorting a list, searching an unordered list, finding a MST in a graph

define tractable, intractable, unknown

Tractable: polynomial time algorithm exists to solve the problem Intractable: problem CANNOT be solved by polynomial time algorithm Unknown: we don't know if there is an algorithm that can solve the problem in polynomial time

Process scheduling for traffic direction

Traffic being directed at a stoplight: round robin With no police officer: First traffic in one direction gets to go, then another direction If police car arrives, switch to priority-based Unlikely to ever be SRT

transport layer

Transport layer: process-process data transfer (TCP, UDP) Ensures that packets are delivered reliably and in the proper order Can break down packets to be smaller if the protocol requires it

Tractable vs. intractable - travelling salesperson problem

Travelling salesperson problem There are n! routes → O(n!) MIGHT BE INTRACTABLE

If it was proved that P = NP, what would be true? all computational problems that can be verified in polynomial time will be solvable in polynomial time. all computational problems will become verifiable in polynomial time. [[they already are verifiable in polynomial time]] all computational problems will be solvable in polynomial time

True: If it was proved that P = NP, all computational problems that can be verified in polynomial time will be solvable in polynomial time. False: all computational problems will become verifiable in polynomial time. [[false: can't check the solution to permutations in poly time.]] False: all computational problems will be solvable in polynomial time Only problems in P and NP (not ALL computational problems) would be solvable in poly time because there are still problems that you probably cannot solve in poly time (intractable problems, like listing permutations).

Church-Turing thesis

Turing machines are capable of solving any effectively solvable algorithmic problem. Turing machines are excellent models for what all real computers are capable of doing.

Define undecidable

UNDECIDABLE: decision problem for which there is PROBABLY no algorithmic solution on a Turing machine Non-existence Not a matter of efficiency

Watson

Uses generate and test Kind of learns form past experience Competed and won on Jeopardy Parallel hardware Natural language understanding and generation A large knowledge base derived via MACHINE LEARNING

Process scheduling - define utilization, throughput, latency, fairness

Utilization: how much work the CPU does Throughput: # of processes that use the CPU in a certain time Latency: average amount of time that processes have to wait before running Fairness: every process gets a chance to use CPU

Memory - volatile, non-volatile

Volatile: memory is erased when power is turned off Registers, RAM Non-volatile: memory remains intact when power is turned off Secondary storage(disk)

Kruskal's - where does complexity come from?

Where does the complexity come from? Sorting takes O(E log E) time. Perform + O(V) operations to connect a vertex to the spanning tree So total time is O(E log E) + O(V) or O(E log V) + O(V), both of which equal O(E log E) or O(E log V). Without much thought on how the edges are stored (as long as you sort them once in the beginning), the complexity is O(E log E).

Insertion sort - worst

Worst: If the array is sorted in reverse order, run time is O(n^2). Also the worst for any array where each element is the smallest or second smallest of the elements before it. Each iteration of the inner loop will scan and shift the entire sorted subsection of the array before inserting the next element. In worst case, there can be n*(n-1)/2 inversions.

FASTEST WAY TO GET OFF THE WAITING QUEUE

ask for I/O

If a game tree b has b branches at each old, and you want to search a depth of d, how many nodes do you need to search

b^d

Insertion sort complexity - best

best case O(n) If the array is already sorted, run time is O(n). This is because, in each iteration, the first remaining element of the input is only compared to the right-most element of the sorted subarray. In the best case, only one comparison needs to be done on each pass. This would be the case for an already sorted list.

Deep Blue - what game does it play?

chess

Define access network

connect end systems to an edge router through access nets by using wired/wireless communication links Examples: residential access nets, institutional access networks, mobile access networks Maybe local area network and wide area network Edge networks connect to local network, and local network connects to core network. An access network is a user network that connects subscribers to a particular service provider and, through the carrier network, to other networks such as the Internet.

internet protocol (IP)

defines format of addresses for system on the Internet and for message headers Connectionless Best effort protocol → unreliable but fast

tractability is a matter of __ while decidability is not

efficiency

Big O logarithms g(n) = loga(n) and g(n) = logb(n) f(n) = loga(n) and g(n) = loga(n^c) f(n) = loga(n) and g(n) = logb(n^c)

g(n) = loga(n) and g(n) = logb(n) are both O(log n) Base doesn't matter because loga(n) = logb(n) / logb(a) f(n) = loga(n) and g(n) = loga(n^c) are both O(log n) f(n) = loga(n) and g(n) = logb(n^c) are both O(log n)

Tractable vs. intractable - subset sum problem

given a set of integers and an integer s, does any non-empty subset sum to s? If the set has N elements, it has 2^n subsets. Enumerating the subsets is the expensive part (makes the algorithm exponential). To check the sum of each subset, it takes maximum of N operations. Checking all subsets = (2^N)*N operations → exponential MIGHT BE INTRACTABLE

what is the internet protocol suite?

has 7 layers.

Define network edge

hosts (which are clients AND servers)

define packet switching, define store and forward, three reasons for delay in PS, loss/queue, connection required?

hosts break messages into packets and forward packets from one router to the next, across links on the path from source to destination Store and forward: enter packets must arrive at router before it can be transmitted to next link Delay in PS is due to three reasons: Delay when packet comes to router Takes time to write packet out to another link Delay to look at packet and decide what to do with it PS is connectionless: no need to establish a connection ahead of time; messages can be addressed and delivered without an advance signal of their arrival Packets can be LOST if too many QUEUE up.

What category of control do self-driving cars have?

hybrid

What is robotics the study of?

intelligent connection of PERCEPTION to ACTION

Component of internet - define ISP

internet service provider

What search algorithm does Deep Blue use?

minimax (which uses heuristics)

benefits of packet switching (2) and 1 disadvantage

more users can use the network; good for bursty data (resource sharing; no call setup); BUT excessive congestion possible due to packet delay and loss, so protocols are needed for reliable data transfer and congestion control

Quicksort - average case

n log n

define circuit switching

need to create and maintain an open circuit for every pair of computers exchanging info like a phone call, you patch together cables to make a circuit. The end-to-end resources are allocated and reserved for the call between source and destination. Dedicated resources (no sharing) Circuit-like (GUARANTEED) performance Circuit segment is idle if not used by the call; still no shared Like a phone call, have to patch cables together to make a circuit

Internet is a __ of __. why?

network of networks more resistant to failure end-t-end communication isn't scalable (it would O(N^2)

Three roles of OS

referee, illusionist, glue

How many vertices does an MST have

same number of vertices as in original graph

What makes a robot

sensor + actuator

What is a client-server model?

server maintains resources in one place; client sends requests for specific info. Allows for scaling on both sides - can have MANY clients using your services; can have MANY servers if you 1 isn't enough.

How does bandwidth at edge compare to it at the core?

slower at edge

define packet

small chunk of data

Components of internet - define host/end systems

synonym for anything connected to a network is an end system, could be servers, computers, your smartphone Hosts can be clients or servers

AlphaGo - what two approaches does it combine

tree search (Monte Carlo search) with deep neural networks

Turing machines - representation table - what is the order of the symbols?

write_symbol, head_move_direction, _state_update Write_symbol is what the TM outputs onto the tape Example: *,Left,1 How to evaluate each move: Can be translated as "Found *, Write *, Move Right, Switch to 3?

Can Turing machines do arbitrary computation?

yes

Does minimax use heuristics?

yes The minimax function returns a heuristic value for leaf nodes (terminal nodes and nodes at the maximum search depth). Non leaf nodes inherit their value, bestValue, from a descendant leaf node. The heuristic value is a score measuring the favorability of the node for the maximizing player. Hence nodes resulting in a favorable outcome, such as a win, for the maximizing player have higher scores than nodes more favorable for the minimizing player. The heuristic value for terminal (game ending) leaf nodes are scores corresponding to win, loss, or draw, for the maximizing player. For non terminal leaf nodes at the maximum search depth, an evaluation function estimates a heuristic value for the node. The quality of this estimate and the search depth determine the quality and accuracy of the final minimax result.


Related study sets

APUSH Chapter 3 Quiz- Morris, Chapter Two Test, APUSH Chapter 1 Quiz- Morris, APUSH Quiz: Chapters 1-2, APUSH CH. 1-4 combie

View Set

Vol. 1 ch.4 workforce safety and wellness

View Set

Chapter 6: Risk Aversion and Capital Allocation to Risky Assets (Review Questions)

View Set