_COMPUTER_SCIENCE__Study_Guide
Table of Contents
[Boolean Algebra] (Week 2)
[Binary Numbers and Data Representation] (Week 3)
[Cardiac] (Week 5)
[Tranquility] (Week 6)
[Cryptography] (Week 9)
Boolean Algebra
NOT / Inversion
NOT (Inversion): negates the input.
Truth Table:
Input: F, F, T, T → Output: F, T, T, F
OR Operation (Logical Disjunction)
Notation: xy, xVy
Truth Table:
A B | Output
0 0 | 0
0 1 | 1
1 0 | 1
1 1 | 1
AND Operation (Logical Conjunction)
Notation: xy, x\y
Truth Table:
A B | Output
0 0 | 0
0 1 | 0
1 0 | 0
1 1 | 1
XOR Operation (Exclusive OR)
Notation: xDy
Truth Table:
A B | Output
0 0 | 0
0 1 | 1
1 0 | 1
1 1 | 0
NOR Operation
Truth Table:
A B | Output
F F | T
F T | F
T F | F
T T | F
NAND Operation
Truth Table:
A B | Output
F F | T
F T | T
T F | T
T T | F
Half Adder
Inputs: A & B
Outputs: Sum & Carry
Truth Table:
A B | Sum Carry
0 0 | 0 0
0 1 | 1 0
1 0 | 1 0
1 1 | 0 1
Full Adder
Inputs: A & B & Carry In (Cin)
Outputs: Sum & Carry Out (Cout)
Truth Table:
A B Cin | Sum Cout
0 0 0 | 0 0
0 0 1 | 1 0
0 1 0 | 1 0
0 1 1 | 0 1
1 0 0 | 1 0 ...
Binary Numbers and Data Representation
Binary Numbers
Binary Example: 00100001 in positional notation represents decimal values 32 + 1 = 33.
Decimal to Binary Conversion Steps:
Divide the number (e.g. 13) by 2 repeatedly until 0 is reached:
13 → 6 (R1)
6 → 3 (R0)
3 → 1 (R1)
1 → 0 (R1)
Read remainders in reverse order: 1101 → 13 in decimal is 1101 in binary.
Hexadecimal Representation
Negative numbers are not represented with + or - signs.
Methods to represent negative numbers:
Sign-magnitude
One's complement
Two's complement
One's Complement
Invert all bits:
0 → 1, 1 → 0.
Example for 4-bit numbers:
Original: 1010 → One's Complement: 0101.
Two's Complement
Steps:
Invert all bits.
Add 1 to the least significant bit (LSB).
Example: -5 as 00101 in binary becomes 11010, which when inverted becomes 00101 then adding 1 resulted in: 001110.
Integer Ranges
Unsigned & Signed Integer ranges for 8, 16, 32, and 64-bit numbers:
8 bit: Unsigned (0-255), Signed (-128 to 127)
16 bit: Unsigned (0-65,535), Signed (-32,768 to 32,767)
32 bit: Unsigned (0-4,294,967,295), Signed (-2,147,483,648 to 2,147,483,647)
Cardiac Assembly Code
Overview
Assembly instructions include:
0 INP: Read input into memory
1 CLA: Clear accumulator and load from memory
2 ADD: Add from memory to accumulator
3 TAC: Test the accumulator, jump if negative
7 SUB: Subtract from accumulator.
9 HRS: Halt and reset.
Example Accumulator Operations
Demonstration of accumulator updates with operations iteratively adjusting values like:
Start with 0 - Each operation modifies it.
Cryptography
Symmetric Encryption
Same key used for both encryption and decryption (private key).
Asymmetric Encryption
Uses a public key for encryption and a private key for decryption (only the recipient can decrypt).
Artificial Intelligence
Search Algorithms
Exploring possible actions based on a set of circumstances; represented in decision trees.
Techniques include: A*, Minmax, α–β pruning.
Minmax Strategy
Players are labeled as MIN and MAX; each selects options based on "goodness" values.
Example: Tic-tac-toe AI's strategy of minimizing the opponent's chances.
Expert Systems
Utilizes a sequence of if-then rules and an inference engine to diagnose diseases or tasks based on user inputs iteratively.
Perceptrons
Step-by-Step Operation
Input: Takes values for decision-making.
Weights: Each input is multiplied by importance.
Summation: Totals computed from weighted inputs.
Threshold Check: Decide output (yes/no) based on threshold comparison.
Example Decision-Making
Factors such as temperature, light level, and cloud cover can influence the decision on whether it is a sunny day.