Introduction Flashcards
What does a problem p specify?
Given an input, what should be the output?
What is each allowed input to the problem called?
An instance
What is: an algorithm for problem P?
A step-by-step prodecure that, when given any instance I for problem P, gives the correct output in a finite amount of time
To describe an algorithm, we must provide a clear, unambiguous sequence of instructions. Anybody should be able to implement it without our help.
For the attached problem P:
What is an example of an instance of problem P?
What would the correct output be of that instance?
Design an algorithm for the attached example, adding two binary numbers.
What are 3 types of questions we often ask about an algorithm?
What is a model of computation?
Why is it important?
In RAM word model, how is data stored in the machine
Data is stored in the machine as word
Each word consists of u binary digits (bits)
(for example u = 32 or u = 64)
In the RAM word model what does each word represent?
Each word represents an integer. The possible values are called the universe u
In the universe U, using standard encoding for signed integers, the range of each word U =?
U = {-2u-1,…,2u-1-1}
In the RAM word model, what can we stored using O(1) words?
Any int, long, float, double can be stored using 0(1) words
How much time does it take to read or write any word in the RAM word model?
What is a primitive operation?
A primitive operation is an instruction that is assumed to take one “CPU step” (i.e., O(1) time, independent on word size u)
What are the primitive operations in the RAM word model?
What are examples of complicated arithmetic operations that are non-primitive