Warning
Rough Notes
This is the list of twelve best physical sciences monologue of the 20th century according to American Scientist.
Found this at TAOCP page.
Assignments help in learning new stuff. This page provides some.
A finite automata is a 5-tuple (Q, E, ∂, q, F), where:
Suppose that you are organizing housing accommodations for a group of four hundred university students. Space is limited and only one hundred of the students will receive places in the dormitory. To complicate matters, the Dean has provided you with a list of pairs of incompatible students, and requested that no pair from this list appear in your final choice. This is an example of what computer scientists call an NP-problem, since it is easy to check if a given choice of one hundred students proposed by a coworker is satisfactory (i.e., no pair taken from your coworker’s list also appears on the list from the Dean’s office), however the task of generating such a list from scratch seems to be so hard as to be completely impractical. Indeed, the total number of ways of choosing one hundred students from the four hundred applicants is greater than the number of atoms in the known universe! Thus no future civilization could ever hope to build a supercomputer capable of solving the problem by brute force; that is, by checking every possible combination of 100 students. However, this apparent difficulty may only reflect the lack of ingenuity of your programmer. In fact, one of the outstanding problems in computer science is determining whether questions exist whose answer can be quickly checked, but which require an impossibly long time to solve by any direct procedure. Problems like the one listed above certainly seem to be of this kind, but so far no one has managed to prove that any of them really are so hard as they appear, i.e., that there really is no feasible way to generate an answer with the help of a computer. Stephen Cook and Leonid Levin formulated the P (i.e., easy to find) versus NP (i.e., easy to check) problem independently in 1971.
A problem is of type P, if it can be solved using an algorithm whose running time grows no faster than some fixed power of number of symbols required to specify the initial data.
A = {1,10,100}
SET = { n | n ∈ Z and n > 5 }
SET = { n | n ∈ N and n < 5 }
SET = {aba}
SET = { ∊ }
SET = ∅
Answer: { ∅, {x},{y},{x,y}}
A x B has a*b elements. A x B stands for cartesian product which is formed as set of tuples taking each element from each set.
So for 2 x 2 set. {a,b} x {c, d} = { (a,c), (a,d), (b,c), (b,d)} Thus there are 4 elements.
1.4 Examine the following formal descriptions of sets so that you understand which members they contain . Write a short informal English description for each set.
It is the set of all odd natural numbers.
It is the set of all even real numbers.
It is set of even natural numbers.
It is set of natural numbers which are divisible by both 2 and 3.
It is set of binary numbers which are bi-directional (that is read the same from left to right and also from right to left).
It is set of all integers.
{x, y} = { ∅, {x}, {y}, {x,y}}
{x, y, z} = { ∅, {x} , {y}, {z}, {x, y} , {y, z}, {x, z}, {x, y, z} }
{a, b, c, d} = { ∅, {a}, {b}, {c}, {d}, {a,b}, {a,c}, {a,d}, {b, c}, {b, d}, {c, d}, {a,b,c}, {a,b,d}, {c,a,d}, {d,a,b}, {a,b,c,d}}
Answer: cC0 + cC1 + cC2 + cC3 + ... + cCc
Take c = 4 Answer = 4C0 + 4C1 + 4C2 + 4C3 + 4C4 = 16
Actually it is 2^n^. I have to find the proof for this.
Let X be the set{1,2,3,4,5} and Y be the set {6,7,8,9,10}. The unary function f: X -> Y and the binary function g: X x Y -> Y are described in the following tables.
||*n*|| f(n)||
||1|| 6||
||2|| 7||
||3|| 6||
||4|| 7||
||5|| 6||
||*g*||6|| 7|| 8|| 9|| 10||
||1||10|| 10|| 10|| 10|| 10||
||2||7|| 8|| 9|| 10|| 6||
||3||7|| 7|| 8|| 8|| 9||
||4||9|| 8|| 7|| 6|| 10||
||5||6|| 6|| 6|| 6|| 6||
Ans: 7
range = {1,2,3,4,5} and domain = {6,7}
Ans: 6
domain: {(1,6),(1,7),(1,8),(1,9),(1,10) .... (5,10)} range: {6,7,8,9,10}
Ans: 8
Ans: (a+b) ^ 2
Ans: / operator?
Ans: multiplication by -1.
Ans: Drawing in the Notebook
Degree of 1 is 3. Degree of 3 is 2. Path from 3 to 4 is 3-2-4.
Ans: {[1,2,3,4,5,6},{(1,4),(1,5),(1,6),(2,4),(2,5),(2,6),(3,4),(3,5),(3,6)}}
1.10 The error is dividing by (a-b) which is 0 because we assume a = b. Dividing by zero is not-defined and hence the proof is not valid.
1.11 The Induction Step is wrong. After assuming that H=K+1 are of same color instead of proving mathematically that K+n can be true, it goes about sub-classing the same set and without proceeding to prove a generality.
1.12 Every graph with 2 or more nodes contains 2 nodes that have equal degrees.
Each edge contributes equally to 2 adjoing nodes or when there is not a edge, the two seperate nodes have an equal lose. Taking both the situations into account, for a given graph with 2 or more nodes, there are 2 nodes that have same degree.
1.13
Clique of a graph is subgraph in which every 2 nodes are connected by an edge. Anti-Clique is the subgraph in which every 2 nodes are not connected by an edge. This is also called as independent set. Show that every graph with n-nodes contains either a clique or an anti-clique with at-least 1/2log2 n nodes.
Answer: This is Ramsey’s therom. Generalized for k=2. For which the minimum number of nodes required is 3.
1.14
Theorem 1.25
P(t) = P*M^t - Y ( M^t - 1) / (M - 1)
P is the principal sum I is the interest rate Y is the monthly payment. M is convenience term for writing M = 1 + I/12
This problem can be solved by using a calculator.
There are 2^903 ways to arrange red, green strings among 43 pegs so each pair is either connected by red string or by a green string.
1) Ramsey Theorem: http://www.math.uchicago.edu/~mileti/museum/ramsey.html
In the book proof of Ramsey Theorem, it divides the nodes into connected (forming cliques) and disconnected (forming anti-cliques), but checking if the degree is greater than 1/2 of no. of remaining nodes, is not understood. (It is like is having a theorem and and following a procedure in order to prove the theorem, there is no counter intuitive example given).
Big O denotes a limiting behavior of function when the argument tends towards a particular value or infinity, usually in terms of a simpler function.
Big O notation allows its users to simplify functions in order to concentrate on their growth rate. Different functions with same growth rate may be represented with the same big O notation.
Description of a function in terms of big O notation usually only provides an upper bound on the growth rate of the function; associated with big O are several related symbols o, Ω, ω, and Θ to describe other kinds of bounds on the asymptotic growth rate.
f(x) = O(g(x)) as x -> ∞
T(n) ∊ O(n^2^) - That is T(n) has n^2^ time complexity.
O(n^c^) and O(c^n^) are very different. The latter grows much, much faster, no matter how big the constant c is (as long as it is greater than one).
Changing units may or may not affect the order of the resulting algorithm. Changing units is equivalent to multiplying the appropriate variable by a constant wherever it appears. For example, if an algorithm runs in the order of n^2^, replacing n by cn means the algorithm runs in the order of c^2^n^2^, and the big O notation ignores the constant c^2^. This can be written as c^2^n^2^ ∊ O(n^2^) . If, however, an algorithm runs in the order of 2^n^, replacing n with cn gives 2^cn^ = (2^c^)^n^. This is not equivalent to 2^n^ in general.
What is Amortized time?
What is inverse Akerman function or even straight Akerman function?
disjoint set? Priority Queue? Polylogarithmic? AKS Primality Test? What is KD-Tree? Lineararithmic? Fast Fourier Transform? Shortest Path on a weighted Digraph with the Floyd-Warshall Algorithm.
Make a list of 10 general-purpose processors including the details like clock speed, word size and manufacturer.
||*uP*||Clock Speed || Word Size || Manufacturer||
||Intel Core i7 EE || 3.33 `GHz` || 64 bit(bus-size) || Intel||
||AMD K10 || 3.1 `GHz` || 64 bit || AMD ||
||ARM 11 ||528 `MHz` ||32 bit ||ARM||
||Cyrix 5x86 || 133 `MHz` || 32 bit || Cyrix||
||DEC 21-40535-04||275 `MHz` ||64 bit ||DEC ||
||IDT Win Chip `W2A` ||300 `MHz` ||32 bit ||IDT||
||Motorola 68060 ||75 Mega Hz ||32 bit ||Motorola||
||NS 320 16 N -10 ||10 Mega Hz ||32 bit ||National Semiconductor||
||NEC D70216 L || 10 Mega Hz || 16 bit || NEC ||
||Nex Gen Nx 586 || 100 Mega Hz || 32 bit || Nex Gen||
||C7 D || 2 Giga Hz || 32 bit || VIA||
||Crusoe TM 5800 || 933 Mega Hz || 64 bit || Transmeta||
The number of bits a CPU can process at once; word size is usually the same as the width of the CPU’s external data bus, but sometimes is smaller. Justify that CPU in personal computer is a general purpose processor.
In a mathematical sense, only three operations are needed to compute any computable function: add one, subtract one and branch if a value is non-zero.
Asymptote is a tangent to a curve at infinity. Something that is asymptotic relates to an asymptote, which is defined as “A Line whose distance to a given curve tends to zero.”
Something asymptotic refers to a limiting behaviour based on a single variable and a desired measure. A common notation that removes constants is called Big O notation, where O means “order of”. Big O denotes the upper bound, how much the time complexity will grow. If we say that a function is O(N) then if N doubles, the funtion’s time complexity at most will double.
I don’t understand this aspect: But because the array is split in half each time, the number of steps is always going to be equal to the base-2 logarithm of N, which is considerably less than O(N).
http://www.eternallyconfuzzled.com/jsw_home.aspx
Big-O is not a mathematical function. It has no inverse.
S -> 0A | 1B | e
A -> 1S |0AA
B -> 0S |1BB
S-> SAB | e
A-> 0S1 | e
B-> 1S0 | e
S -> L D A B C R
LDA -> LAAD
ADA -> AAD
ADB -> ABBD
BDB -> BBD
BDC -> BCCD
CDC -> CCD
DR -> ER
CE -> EC
BE -> EB
AE -> EA
LE -> LD
A->0
B->1
C->0
R->e
LD->e
S -> 0S1M |e
M -> 0M |e
* 0^p^1^n^0^n^
* Context Free Language are closed under concatenation.
* Intersection the above two? 0^n^1^n^0^n^
* Context Free Grammare are not closed under Intersection.
* CFG Are NOT closed under Complement.
<stmt> -> <assgn> | <ifthen> | <ifthenelse> |<beginend>
<ifthen> -> if <expression> then <stmt>
<ifthenelse> -> if <expression> then <stmt> else <stmt>
A-> BC
B -> o
1 - 2
2 - 4
3 - 7
4 - 11
n - Tn + 1 ?
R ⊕ W = (R+W) -(RW)
R ⊕ W = (-RW) + (-WR)
-(A⋂B) = -A ⋃ -B
-(A⋃B) = -A ⋂ -B
(R+W)-(RW)
(R -(RW) ) + (W -(RW))
(R (-R + -W)) + (W (-R + -W))
(R-R) + R-W + W-R + W-W
R-W + W-R
I discovered later that I wasn’t even a very good C programmer, hiding my ignorance of structures, _malloc( ) and free( ), setjmp( ) and longjmp( ),_ and other “sophisticated” concepts, scuttling away in shame when the subjects came up in conversation instead of reaching out for new knowledge.
1 2 3 4 - Big Endian
0x00 0x00 0x00 0x01
4 3 2 1 - Little Endian
$ python -c "import struct;print 'little' if ord(struct.pack('L',1)[0]) else 'big'"
little
Given a positive number N, generate all the prime numbers from 2 to N. The primary emphasis in the solution to this problem should be on speed. In addition, you must not consume an inordinate amount of memory.
Implement an arbitrary precision arithmetic calculator. You should implement addition, subtraction, multiplication and division in the respective order. Try to make your program as fast as possible and keep memory usage to the bare minimum.
Given two strings S1 and S2, determine whether S2 occurs as a substring in S1 and if so, find the first occurrence of S2 in S1. Your program should be extremely fast. Try to come up with a linear solution to the problem.
Section B
Implement a simple filesystem within a normal file on the hard disk, i.e. treat the file as a virtual disk and implement the filesystem by manipulating records within the file.
You are free to devise your own scheme for the file system but it should minimally support the following operations:
- Create - Create a virtual hard disk on a file of the specified size and “format” it. Formatting would essentially involve initialising disk allocation structures and whatever else you need to do before you can have a valid filesystem.
- Open, Read, Write, Close - All the normal file operations to use the files.
- Delete, Rename - Remove unwanted files or rename existing files.
Do not place artificial restrictions on file names, sizes, etc.
In addition, if you can, provide support for folders (also known as directories) which can be arbitrarily nested. Provide all the common operations for folders.
You should implement this as a library of routines that can be used by anyone wanting to treat a file as a filesystem. Demonstrate the correctness of your routines by writing a demo program that lets one manipulate files interactively.