Chapter 6
O(1).O(n).O(n^2).n; space complexity measures how much extra memory the algorithm uses as a function of n.T(n) = 2T(n/2) + n.T(n) = aT(n/b) + f(n) (a β₯ 1, b > 1), comparing f(n) against n^(log_b a). Case 1: f(n) = O(n^(logb a - Ξ΅)) gives T(n) = Ξ(n^(logb a)). Case 2: f(n) = Ξ(n^(logb a)) gives T(n) = Ξ(n^(logb a) Β· log n). Case 3: f(n) = Ξ©(n^(logb a + Ξ΅)) with the regularity condition holding gives T(n) = Ξ(f(n)).O(log n) time.3n/2 comparisons overall, versus about `2n` comparisons for a naive linear scan that finds min and max separately.O(n log n) in best, average, and worst case; O(n) extra space; stable; divides array in half, recursively sorts, then merges.O(n log n); worst O(n^2); O(log n) space (recursion stack, in-place partitioning); NOT stable; performance depends heavily on pivot choice.O(n log n), O(log n) space; picks pivot randomly, avoiding the worst case on already-sorted/adversarial input with high probability.O(n^2) occurs when the pivot repeatedly splits the array very unevenly (e.g. a sorted array with a fixed first/last-element pivot); its best/average case O(n log n) occurs when the pivot roughly balances the two partitions each time.O(n), then repeatedly removes the root (the max/min) and re-heapifies (O(log n) per removal), giving an overall time complexity of O(n log n); it sorts in-place, needing only `O(1)` extra space.O(n log n) time.O(n) time.O(n^3) time, O(n^2) space.O(mn) time and space, for strings of length m and n.O(nW) time and space.O(V^3) time, O(V^2) space.O(n^2 Β· 2^n) with DP (Held-Karp), versus O(n!) for brute force..OBJ files produced by the assembler/compiler into a single .EXE (or .COM) executable file..so files), allowing multiple programs to share one loaded copy of a library.MACRO ... MEND, that can accept parameters and be invoked (called) elsewhere in the program.&PARAM with a suffix to form a new variable/label name).AA0001, AA0002, ...) to avoid duplicate-label errors when a macro containing a label is expanded more than once.IF / ELSE / ENDIF inside a macro body to control which statements are actually generated, based on given conditions.PARAM=value) instead of by position, allowing arguments to be supplied in any order and to have default values.#define and #ifdef to perform textual substitution before the source code is actually compiled.CLOSED β LISTEN/SYN_SENT β SYN_RCVD β ESTABLISHED (via the 3-way handshake: SYN, SYN-ACK, ACK), then FIN_WAIT/CLOSE_WAIT β TIME_WAIT β CLOSED during connection teardown (a 4-way exchange of FIN/ACK segments).sockaddr_in for IPv4) holds the address family, port number, and IP address, and is used with calls such as bind() and connect().htons()/htonl() convert a value from host to network byte order; ntohs()/ntohl() convert from network back to host byte order (for 16-bit and 32-bit values respectively).socket() creates a new socket (returns a descriptor), bind() associates it with a local IP/port, listen() marks it passive/ready to accept connections, accept() accepts an incoming connection (returns a new socket), connect() initiates a connection (client-side), send()/recv() transfer data, and close() terminates the socket and releases its resources.select()/poll()/epoll() and handles whichever becomes ready), Signal-driven I/O (the kernel sends a signal, e.g. SIGIO, to notify the process once I/O is ready), and Asynchronous I/O (the kernel performs the entire operation, including copying the data, and notifies the process only upon full completion β no blocking at all).WINSOCK.DLL, now WS2_32.DLL for Winsock 2), providing a BSD-socket-compatible API on Windows; Windows Socket Extensions add Windows-specific capabilities beyond standard BSD sockets, such as asynchronous notification via window messages and overlapped I/O.