Sign and magnitude
First bit = sign (0 = +, 1 = -); remaining bits = magnitude. Issue: two zeros (+0/-0).
Two’s complement
Negative numbers: invert bits + add 1. Solves negative zero; simplifies subtraction.
Normalisation (floating point)
Adjusts mantissa/exponent so mantissa starts with 0.1 (positive) or 1.0 (negative); maximises precision.
Renormalisation after arithmetic
After addition/subtraction, mantissa may need shifting left/right and exponent adjusting to maintain normalised form.
Bitwise AND mask use
Used to clear bits (set to 0).
Bitwise OR mask use
Used to set bits (set to 1).
XOR bitwise use
Used to toggle/flip bits.
Difference between ASCII and UNICODE
ASCII = 7/8 bit, 128/256 chars, English focused. UNICODE = 16/32 bit, covers global characters (emojis, symbols).
UTF-8 vs UTF-16
UTF-8: Variable length (1-4 bytes), ASCII compatible. UTF-16: 2 or 4 bytes, better for Asian languages.
Stack (LIFO)
Last In, First Out. Push, Pop. Uses: call stack, undo function.
Queue (FIFO)
First In, First Out. Enqueue, Dequeue. Uses: print spooler, ready queue.
Linked list
Nodes containing data and pointer to next node; dynamic size; sequential access.
Binary Search Tree property
Left child < Parent < Right child.
Hash table
Uses hash function to compute index; O(1) average lookup.
Graph (directed vs undirected)
Directed: edges have direction (one-way). Undirected: edges are bidirectional.
Tree
Hierarchical structure; root, parent, child, leaf nodes; no cycles.
How to delete from a linked list?
Adjust pointers of previous node to skip the node to be deleted; deallocate memory.
De Morgan’s First Law
NOT (A AND B) = (NOT A) OR (NOT B).
De Morgan’s Second Law
NOT (A OR B) = (NOT A) AND (NOT B).
Distribution law
A AND (B OR C) = (A AND B) OR (A AND C); A OR (B AND C) = (A OR B) AND (A OR C).
Association law
(A AND B) AND C = A AND (B AND C); (A OR B) OR C = A OR (B OR C).
Commutation law
A AND B = B AND A; A OR B = B OR A.
Double negation
NOT (NOT A) = A.
D type flip flop
1-bit memory; stores state on clock edge; data (D) transferred to output (Q).