📚 Interdisciplinary Integrated Question Training for CIE Year 12 Computer Science | CIE 12年级计算机科学跨学科综合题型训练
In the CIE AS-Level Computer Science syllabus (Year 12), students must not only master core computational concepts but also apply them in unfamiliar contexts that often blend knowledge from mathematics, physics, economics, linguistics, and other disciplines. This article presents a curated set of interdisciplinary question types designed to bridge computing with real-world problems. Each section introduces a topic, a sample scenario, and how to deconstruct it using the computational thinking framework: abstraction, decomposition, pattern recognition, and algorithm design. By practicing these cross-curricular challenges, you will deepen your understanding of both the subject matter and the versatile power of computer science.
在 CIE AS 阶段(Year 12)计算机科学课程中,学生不仅需要掌握核心计算概念,还要能够在跨学科的陌生情境中应用它们,这些情境往往融合了数学、物理、经济、语言学等多个学科的知识。本文精选了一组跨学科综合题型,旨在将计算机科学与现实世界问题连接起来。每个小节介绍一个主题、一个范例场景,并展示如何运用计算思维框架(抽象、分解、模式识别和算法设计)来拆解问题。通过练习这些交叉学科挑战,你将加深对学科内容的理解,并体会到计算机科学的多用途力量。
1. Information Theory and Data Compression | 信息论与数据压缩
In CIE computer science, students learn lossless and lossy compression, Huffman coding, and run-length encoding. A common interdisciplinary question links these to Shannon’s information entropy from mathematics and physics. For example: “A weather station records temperature values (integers from -10 to 40 °C) every minute. Analyse the entropy of the data and design a Huffman tree to compress a typical day’s readings. Discuss how the compression ratio changes if a cold front cause temperatures to cluster around 0 °C. Justify your design using both computer science and meteorological reasoning.”
在 CIE 计算机科学中,学生要学习无损压缩、有损压缩、哈夫曼编码和行程长度编码。一种常见的跨学科题目将这些与来自数学和物理的香农信息熵联系起来。例如:“一个气象站每分钟记录温度值(-10到40°C的整数)。分析数据的熵,并设计一棵哈夫曼树来压缩典型一天的读数。讨论若一次冷锋使温度聚集在0°C附近,压缩比会如何变化。请结合计算机科学和气象学推理来证明你的设计。”
To tackle this, decompose the problem: first calculate the probability distribution of temperatures under normal and cold-front conditions using historical data (applied statistics). Then compute the entropy H = -Σ p(x) log₂ p(x). Higher entropy means less redundancy and lower compression. The Huffman tree assigns shorter codes to more frequent values. The cold front reduces entropy, so the compression ratio improves. This question tests data representation, algorithm design, and cross-disciplinary data analysis.
处理此问题需分解:首先根据历史数据(应用统计)计算正常和冷锋条件下温度的频率分布。然后计算熵 H = -Σ p(x) log₂ p(x)。熵越高,冗余越低,压缩率越小。哈夫曼树为频率高的值分配短码。冷锋降低了熵,因此压缩比提升。这道题考查数据表示、算法设计以及跨学科数据分析。
2. Boolean Logic and Electronic Circuits | 布尔逻辑与电子电路
Logic gates are a staple of Year 12. Questions often merge physics by asking students to interpret or design simple sensor-driven logic circuits. For instance: “A greenhouse uses a light sensor (L, output high when dark) and a moisture sensor (M, output high when soil is dry). An automatic watering system should activate (W=1) when it is dark AND the soil is dry, but NOT if a manual override switch (O) is pressed. Draw the logic circuit using only NAND gates and write the Boolean expression. Then explain how a transistor-resistor implementation of the NAND gate works in terms of current flow.”
逻辑门是12年级的基础内容。题目常常结合物理,要求学生解释或设计简单的传感器驱动逻辑电路。例如:“温室使用光照传感器(L,天黑时输出高电平)和湿度传感器(M,土壤干燥时输出高电平)。一个自动浇水系统应在天黑并且土壤干燥时启动(W=1),但如果手动超控开关(O)被按下,则停止。只用与非门画出逻辑电路并写出布尔表达式。然后从电流流动角度解释如何用晶体管-电阻实现与非门。”
First, produce the Boolean expression: W = L AND M AND (NOT O). To use only NAND gates, convert using De Morgan’s laws. A possible solution: compute NAND(L, M) = X, then NAND(X, O) is not enough; we need X NAND (O NAND O) = NAND(X, NOT O) which gives NOT (X AND NOT O) = NOT (L AND M AND NOT O). Wait, we want W = L·M·O’. The NAND of X and (O NAND O) is NAND(X, NOT O) = NOT (X AND NOT O) = NOT(L·M·O’) = (L·M·O’)’, which is the complement. So we need an inverter at the end. This requires design. For the physics part, describe how a NAND gate built with two transistors in series for the pull-down and two in parallel for pull-up works.
首先写出布尔表达式:W = L AND M AND (NOT O)。为只用与非门实现,需用德摩根律转换。一种方案:计算 L 和 M 的与非结果 X,然后 X 与 O 的与非(O 自身与非得到非 O)再进行与非,得到 (L·M·O’)’,最后再加一个与非门反相。物理部分描述两个串联晶体管下拉、两个并联上拉如何构成与非门,并解释电流路径。
3. Database Normalisation and Business Economics | 数据库规范化与商业经济学
CIE AS covers relational databases and normalisation up to 3NF. Cross-disciplinary questions frequently embed this in business scenarios. Example: “A small e-commerce company stores orders in a single table: Orders(OrderID, CustomerName, CustomerEmail, ProductID, ProductDescription, UnitPrice, Quantity, OrderDate). Identify anomalies and normalise the table to 3NF. The marketing department wants to analyse the average order value per customer by city, but city information is missing. Propose a database modification and an SQL query that joins three tables to output the average order value per city. Discuss how this supports dynamic pricing strategies in economics.”
CIE AS 涵盖关系数据库和直到第三范式的规范化。跨学科题目常将此嵌入商业场景。例如:“一家小型电商公司将订单存储在一张表中:Orders(OrderID, CustomerName, CustomerEmail, ProductID, ProductDescription, UnitPrice, Quantity, OrderDate)。识别异常并将表规范化至3NF。市场部希望按城市分析每个客户的平均订单价值,但缺少城市信息。提出数据库修改方案,并写出一条连接三张表的 SQL 查询,输出每城市的平均订单价值。讨论这在经济学上如何支持动态定价策略。”
Decomposition: The unnormalised table contains partial dependencies (ProductDescription, UnitPrice depend on ProductID) and transitive dependencies (CustomerEmail determines CustomerName). Normalised tables: Customers(CustomerID, CustomerName, CustomerEmail, City), Products(ProductID, ProductDescription, UnitPrice), Orders(OrderID, CustomerID, OrderDate), OrderItems(OrderID, ProductID, Quantity). SQL: SELECT c.City, AVG(p.UnitPrice * oi.Quantity) AS AvgOrderValue FROM Customers c JOIN Orders o ON c.CustomerID = o.CustomerID JOIN OrderItems oi ON o.OrderID = oi.OrderID JOIN Products p ON oi.ProductID = p.ProductID GROUP BY c.City; This data can inform geographic price discrimination.
分解:未规范化的表包含部分依赖(ProductDescription、UnitPrice 依赖 ProductID)和传递依赖(CustomerEmail 决定 CustomerName)。规范化后的表:Customers(CustomerID, CustomerName, CustomerEmail, City), Products(ProductID, ProductDescription, UnitPrice), Orders(OrderID, CustomerID, OrderDate), OrderItems(OrderID, ProductID, Quantity)。SQL:SELECT c.City, AVG(p.UnitPrice * oi.Quantity) AS AvgOrderValue FROM Customers c JOIN Orders o ON c.CustomerID = o.CustomerID JOIN OrderItems oi ON o.OrderID = oi.OrderID JOIN Products p ON oi.ProductID = p.ProductID GROUP BY c.City; 此数据可为地理价格歧视提供依据。
4. Finite State Machines and Linguistics | 有限状态机与语言学
The concept of finite state machines (FSMs) is taught for string processing and control systems. Linguistics provides a rich context. Consider: “Design an FSM that accepts all strings over the alphabet {a, b} where the string contains the substring ‘aba’ exactly once. Show the state transition diagram. Then explain how this FSM can be modified to model the phonological rule in English that ‘/k/’ is aspirated at the beginning of a stressed syllable (e.g., ‘cat’ vs. ‘skit’). Critically discuss the limitations of FSMs in modelling natural language syntax.”
有限状态机(FSM)的概念用于字符串处理和控制系统。语言学提供了丰富的背景。考虑:“设计一个 FSM,接受字母表 {a, b} 上所有恰好包含一次子串 ‘aba’ 的字符串。画出状态转移图。然后解释如何修改此 FSM 来模拟英语语音学规则:/k/ 在重读音节开头送气(如 ‘cat’ 对比 ‘skit’)。批判性地讨论 FSM 在模拟自然语言句法方面的局限性。”
The FSM needs states: start, seen ‘a’, seen ‘ab’, seen ‘aba’ (accepting), and then after seeing more, ensure no second ‘aba’ occurs, so states for potential second occurrence, leading to a trap state. For phonology, input symbols could be phonemes and stress markers; states track whether we are at the start of a stressed syllable; if yes, output an aspirated version of /k/. The limitation is that FSMs cannot handle center-embedding recursion typical in syntax (e.g., “The rat the cat chased died”), which requires context-free grammars, highlighting the Chomsky hierarchy.
FSM 状态包括:起始、见到 ‘a’、见到 ‘ab’、见到 ‘aba’(接受态),然后继续处理,确保不出现第二个 ‘aba’,设置检测第二个 ‘aba’ 的状态,最终进入陷阱状态。语音学模型以音素和重音标记为输入符号;状态跟踪是否位于重读音节开头,若是则输出送气版本。局限性在于 FSM 无法处理句法中典型的中心嵌入递归(例如“猫追的老鼠死了”),此类需要上下文无关语法,体现了乔姆斯基层级。
5. Sorting Algorithms and Sports Analytics | 排序算法与体育分析
Sorting is fundamental. A sports analytics scenario: “A football league tracks player performance metrics (goals, assists, distance covered) for 500 players. The coaching staff needs to rank players by a composite score: Score = 2*Goals + Assists + 0.01*Distance. Choose the most appropriate sorting algorithm (from bubble, insertion, merge, and quick sort) for a dataset that arrives weekly partially sorted because only some players’ metrics change significantly. Justify your choice using time complexity analysis and the nature of the data. Then write pseudocode for the selected algorithm, and explain how this ranking system could be implemented using parallel processing for real-time updates during a match.”
排序是基础内容。一个体育分析场景:“一个足球联赛跟踪 500 名球员的表现指标(进球、助攻、跑动距离)。教练组需要按综合分数对球员排名:分数 = 2*进球 + 助攻 + 0.01*跑动距离。选择最合适的排序算法(冒泡、插入、归并或快速排序),数据集每周更新,且因只有部分球员指标显著变化而大致有序。根据时间复杂度和数据特征证明你的选择。然后为所选算法写伪代码,并解释如何在比赛期间使用并行处理实现此排名系统的实时更新。”
Because the list is nearly sorted, insertion sort would perform in O(n) best case, which is excellent for 500 items. Merge and quick sorts are O(n log n) but overhead is larger for small n; bubble sort is O(n²). Insertion sort works well for nearly-sorted data. Pseudocode: for i from 1 to n-1: key = A[i], j = i-1; while j>=0 and A[j].score < key.score: A[j+1] = A[j]; j--; A[j+1] = key; For parallel processing, split the list into chunks assigned to different threads, each sorts with insertion, then a merge step combines them, similar to a parallel merge sort.
由于列表几乎有序,插入排序的最佳情况时间复杂度为 O(n),对于 500 项数据非常高效。归并和快速排序为 O(n log n),但开销较大;冒泡排序为 O(n²)。插入排序非常适合近乎有序的数据。伪代码:for i from 1 to n-1: key = A[i], j = i-1; while j>=0 and A[j].score < key.score: A[j+1] = A[j]; j--; A[j+1] = key。并行处理时,将列表分成块分配给不同线程,各自用插入排序,然后合并步骤将它们组合,类似于并行归并排序。
6. Encryption and Number Theory | 加密与数论
CIE covers symmetric and asymmetric encryption, including RSA. A classic cross-curricular problem involves pure mathematics. Example: “Explain how RSA encryption relies on the mathematical difficulty of factoring large semiprimes. Suppose Bob’s public key is (n=33, e=3) and his private key is d. Find d using Euler’s totient function φ(n). Encrypt the message M=7. A hacker observes many ciphertexts and notices that the plaintexts are always small integers (1-10) representing sensor readings. Explain how this weakens the security and suggest a cryptographic padding scheme to mitigate the risk. Relate your answer to the discrete logarithm problem’s role in Diffie-Hellman key exchange as an alternative.”
CIE 涵盖对称和非对称加密,包括 RSA。一个经典的跨学科问题涉及纯数学。例如:“解释 RSA 加密如何依赖分解大合数的数学困难性。假设 Bob 的公钥为 (n=33, e=3),私钥为 d。使用欧拉函数 φ(n) 求 d,并加密消息 M=7。一名黑客观察到许多密文,并注意到明文总是代表传感器读数的小整数(1-10)。解释这如何削弱安全性,并提出一种密码学填充方案来降低风险。将你的答案与 Diffie-Hellman 密钥交换中的离散对数问题的作用联系起来,作为替代方案。”
n=33, p=3, q=11, φ(n)=20. e=3, so d is the modular multiplicative inverse of 3 mod 20, which is 7 because 3*7=21≡1. Encrypt: C = 7³ mod 33 = 343 mod 33 = 13. Small message space allows a brute-force dictionary attack; an attacker can precompute encryptions of 1-10 and match. Padding like OAEP adds random data to the plaintext before encryption, making it a full-sized block. The discrete logarithm problem: given g^a mod p, finding a is hard, underpinning Diffie-Hellman, which establishes a shared secret without prior secure channel.
n=33,p=3,q=11,φ(n)=20。e=3,因此 d 是 3 模 20 的乘法逆元,为 7,因为 3×7=21≡1。加密:C = 7³ mod 33 = 343 mod 33 = 13。消息空间小易遭受字典攻击;攻击者可预先计算 1-10 的密文并比对。填充方案如 OAEP 在加密前向明文添加随机数据,使其成为完整大小的块。离散对数问题:给定 g^a mod p,求 a 困难,这支撑了 Diffie-Hellman,无需事先安全通道即可建立共享秘密。
7. Processor Interrupts and Real-Time Physics Experiments | 处理器中断与实时物理实验
Interrupt handling is a core hardware topic. It can be linked to experimental physics. For instance: “In a particle physics experiment, a sensor sends a digital pulse to the CPU via an interrupt line each time a particle is detected. The CPU must record the timestamp with microsecond precision. Explain the sequence of events from the interrupt request (IRQ) to the completion of the interrupt service routine (ISR). The experiment generates up to 10,000 pulses per second. Assuming an ISR execution time of 2 microseconds, evaluate whether a single-core processor can keep up. If not, propose a hardware solution using buffering or direct memory access (DMA), and discuss the trade-offs with interrupt latency.”
中断处理是核心硬件主题,可与实验物理结合。例如:“在一个粒子物理实验中,传感器每次检测到一个粒子就通过中断线向 CPU 发送一个数字脉冲。CPU 必须以微秒精度记录时间戳。解释从中断请求(IRQ)到中断服务程序(ISR)完成的事件序列。该实验每秒产生最多 10,000 个脉冲。假设 ISR 执行时间为 2 微秒,评估单核处理器是否能跟上。若不能,提出一种使用缓冲或直接存储器访问(DMA)的硬件解决方案,并讨论与中断延迟的权衡。”
Sequence: sensor asserts IRQ line → CPU finishes current instruction, saves PC and flags onto stack, vectors to ISR → ISR reads timer register, stores timestamp in buffer, acknowledges interrupt, restores context, returns. Max IRQ rate = 1/(2 μs) = 500 kHz, which is far above 10 kHz, so a single core could theoretically keep up. However, if other interrupts occur or ISR is longer, buffering helps. A FIFO buffer in hardware accumulates timestamps; CPU reads multiple entries per ISR, reducing overhead. DMA could transfer blocks from a timestamp counter directly to memory, offloading CPU. Trade-off: added complexity and potential increased latency.
序列:传感器拉低 IRQ 线 → CPU 完成当前指令,将 PC 和标志寄存器压栈,跳转到 ISR → ISR 读取定时器寄存器,存储时间戳至缓冲区,确认中断,恢复上下文,返回。最大 IRQ 速率 = 1/(2 μs) = 500 kHz,远高于 10 kHz,因此单核理论上可处理。但若有其他中断或 ISR 更长,缓冲有帮助。硬件 FIFO 缓冲累积时间戳;CPU 每次 ISR 读取多个条目,减少开销。DMA 可将时间戳计数器的数据块直接传送到内存,解放 CPU。权衡:增加复杂性,可能增大延迟。
8. Graphs and Social Network Analysis | 图与社交网络分析
Graph data structures appear in the syllabus via adjacency matrices and lists. Social networks provide compelling scenarios. Problem: “A social network has 1000 users. The friendship relation is represented as an undirected graph. The company wants to detect ‘influencers’ using the concept of degree centrality (number of friends) and betweenness centrality. Describe how to compute degree centrality from an adjacency matrix. To compute betweenness centrality, you need the shortest paths between all pairs. Outline an algorithm (e.g., BFS) and explain its time complexity. Then discuss the ethical implications of storing and analysing user relationships, referencing the Data Protection Act.”
图数据结构通过邻接矩阵和邻接表出现在大纲中。社交网络提供了引人入胜的场景。问题:“某社交网络有 1000 名用户。好友关系表示为无向图。公司希望使用度中心性(好友数量)和介数中心性概念检测“影响者”。描述如何从邻接矩阵计算度中心性。要计算介数中心性,需要所有节点对之间的最短路径。概述一种算法(如 BFS)并解释其时间复杂度。然后讨论存储和分析用户关系的伦理影响,并引用数据保护法。”
Degree centrality: sum rows of adjacency matrix (or count non-zero entries in list). Betweenness centrality: for each node v, count how many shortest paths between any pair (s,t) pass through v. For 1000 nodes, all-pairs shortest path using BFS from each node takes O(V*(V+E)) = O(V³) in worst dense graph. Floyd-Warshall is O(V³) as well. Ethically, the analysis may violate privacy if users haven’t consented; data must be processed fairly, lawfully, and for specified purposes under GDPR/DPA.
度中心性:对邻接矩阵的行求和(或统计邻接表中非零条目)。介数中心性:对每个节点 v,计算任意节点对 (s,t) 之间经过 v 的最短路径数量。对于 1000 个节点,从每个节点运行 BFS 的全对最短路径算法,最坏情况密集图下时间复杂度 O(V³)。Floyd-Warshall 同样 O(V³)。伦理上,若用户未同意,分析可能侵犯隐私;根据 GDPR/DPA,数据必须公平、合法、以指定目的处理。
9. Recursion and Mathematical Induction | 递归与数学归纳法
Recursion is a key programming concept, closely linked to proof by induction in mathematics. A typical question: “The Fibonacci sequence is defined as F(1)=1, F(2)=1, F(n)=F(n-1)+F(n-2) for n>2. Write a recursive function in pseudocode to compute F(n). Analyse its time complexity using a recurrence relation. Prove by induction that F(n) < 2^n for all n >= 1. Then refactor the function using memoization to achieve O(n) time, explaining how the data structure stores previously computed values. Connect this optimisation to dynamic programming and give an example of a real-world problem (e.g., rod cutting) where memoization significantly reduces computation.”
递归是关键的编程概念,与数学归纳法紧密相连。典型问题:“斐波那契数列定义为 F(1)=1,F(2)=1,当 n>2 时 F(n)=F(n-1)+F(n-2)。用伪代码写递归函数计算 F(n)。用递推关系分析其时间复杂度。通过归纳法证明对所有 n >= 1,F(n) < 2^n。然后使用记忆化重构函数达到 O(n) 时间,解释如何用数据结构存储已计算值。将此优化与动态规划联系起来,并给出现实世界问题(如钢条切割)的例子,说明记忆化如何显著减少计算量。”
Recursive pseudocode: if n <= 2 return 1; else return fib(n-1) + fib(n-2). Time complexity: T(n) = T(n-1) + T(n-2) + O(1), solving to O(2^n). Induction: base n=1,2 trivial; assume F(k) < 2^k for k 递归伪代码:if n <= 2 return 1; else return fib(n-1) + fib(n-2)。时间复杂度:T(n) = T(n-1) + T(n-2) + O(1),解得 O(2^n)。归纳法:基础 n=1,2 简单;假设 k Although AI is officially in the A2 syllabus, basic search algorithms like breadth-first and depth-first are AS topics and can be applied to game trees. Cross-curricular with psychology and strategy: “A simple two-player game uses a search tree of depth 4 with branching factor varying between 2 and 5. The leaves contain utility values. Implement a minimax algorithm using depth-first search to find the best move for the first player. Explain how alpha-beta pruning reduces the number of evaluated nodes. Then relate this decision-making process to human cognitive biases (e.g., limited lookahead in chess) and discuss how heuristics can guide search when full depth is computationally infeasible, drawing parallels with bounded rationality in psychology.” 虽然 AI 正式属于 A2 大纲,但广度优先和深度优先等基本搜索算法是 AS 主题,可应用于博弈树。与心理学和策略跨学科:“一个简单的双人游戏使用深度为 4,分支因子在 2 到 5 之间的搜索树。叶子包含效用值。使用深度优先搜索实现极小极大算法,为第一位玩家找到最佳走法。解释 α-β 剪枝如何减少评估节点数。然后将此决策过程与人类认知偏差联系起来(如国际象棋中有局限的前瞻),并讨论当完全深度计算不可行时,启发式如何指导搜索,与心理学中的有限理性相类比。” Minimax: recursively, if depth 0 or terminal, return utility; if MAX node, return max over children; if MIN node, return min. Alpha-beta: track α (best for MAX), β (best for MIN); prune when α ≥ β. This reduces effective branching factor significantly. Humans often use pattern recognition and heuristics to prune mentally, which can lead to biases like anchoring. In computer science, evaluation functions replace deep search with heuristic estimates, enabling real-time play, resembling Simon’s bounded rationality where agents satisfice rather than optimise due to cognitive limits. 极小极大:递归地,若深度 0 或终局,返回效用值;MAX 节点取子女最大值;MIN 节点取最小值。α-β 剪枝:跟踪 α(MAX 最佳值),β(MIN 最佳值);当 α ≥ β 时剪枝,显著降低有效分支因子。人类常使用模式识别和启发式来脑内剪枝,这可能导致锚定等偏差。计算机科学中,评价函数用启发式估计替代深层搜索,使实时游戏成为可能,类似于西蒙的有限理性,即智能体因认知局限而追求满意而非最优。 Scheduling algorithms (round robin, shortest job first, priority) are core OS topics. A healthcare analogy: “A hospital emergency department triages patients. Patients arrive with different severities (priority) and expected treatment times (burst time). Define a mixed scheduling policy that combines preemptive priority for critical patients and round robin for stable patients with a time quantum of 10 minutes. Calculate average waiting time for a given table of patient arrivals. Critically evaluate how starvation might occur for low-priority patients and propose a solution using aging, analogous to OS techniques. Discuss the ethical dimension of resource allocation in healthcare vs. computer systems.” 调度算法(轮转、最短作业优先、优先级)是核心 OS 主题。一个医疗类比:“医院急诊室对患者分诊。患者到达时具有不同严重程度(优先级)和预计治疗时间(突发时间)。定义一种混合调度策略:对危重患者采用抢占式优先级,对稳定患者采用时间片为 10 分钟的轮转法。计算给定患者到达表的平均等待时间。批判性地评估低优先级患者如何可能饿死,并提出一种使用老化(aging)的解决方案,与 OS 技术类似。讨论医疗保健与计算机系统中资源分配的伦理维度。” Implementation: two queues – high priority (preemptive) and normal (RR). When a critical patient arrives, current normal patient is preempted if not critical. Aging: after a patient waits longer than a threshold, increase their priority incrementally until they are eventually treated. Calculation involves Gantt chart. Ethically, computer systems treat all processes as objects, but in healthcare, human lives are at stake; utilitarianism vs. deontological ethics create different scheduling goals. This highlights the need for fairness mechanisms. 实现:两个队列——高优先级(抢占式)和常规(轮转)。当危重患者到达,若当前不是危重患者则抢占。老化:等待超过阈值后,逐渐提升患者的优先级直至得到治疗。计算涉及甘特图。伦理上,计算机系统将所有进程视为对象,但医疗保健关乎人命;功利主义与道义论伦理会导致不同的调度目标。这凸显了公平机制的必要性。 From binary to bitmap images, AS students learn colour depth, resolution, and file size calculations. An art-inspired task: “An artist creates a 256×256 pixel digital mosaic where each tile can be one of 16 colours. Calculate the minimum file size in bytes if no compression is used. Then, the artist wants to add a transparency channel for each pixel (on/off). Explain how the file size changes and how run-length encoding (RLE) can compress the image given that large areas are uniform colour. Using RLE, compress a sample 5×5 tile grid, and analyse the compression ratio. Finally, discuss how vector graphics (SVG) could represent the same mosaic more efficiently for geometric patterns, contrasting the raster approach.” 从二进制到位图图像,AS 学生学习色深、分辨率和文件大小计算。一个受艺术启发的任务:“一位艺术家创作一幅 256×256 像素的数字马赛克,每块瓷砖可以是 16 种颜色之一。计算不使用压缩时的最小文件大小(字节)。然后,艺术家想为每个像素添加一个透明通道(开/关)。解释文件大小如何变化,以及鉴于大面积颜色均匀,行程长度编码(RLE)如何压缩图像。使用 RLE 压缩一个示例 5×5 瓷砖网格,并分析压缩比。最后,讨论矢量图形(SVG)如何为几何图案更高效地表示同一马赛克,与光栅方法对比。” 16 colours require 4 bits per pixel. 256x256x4 = 262,144 bits = 32,768 bytes. Adding 1-bit transparency makes it 5 bits per pixel, increasing size to 40,960 bytes without compression. RLE: runs of same colour stored as (colour, count). Example 5×5 grid: row1: 3 white, 2 black could be (W,3)(B,2). If image has large uniform blocks, compression ratio can be high. Vector graphics store shapes mathematically, so a mosaic of identical square tiles can be defined as a single repeated element with coordinates, using far less data than raster, illustrating the trade-off between representation methods. 16 种颜色每像素需 4 位。256×256×4 = 262,144 位 = 32,768 字节。添加 1 位透明度后每像素 5 位,无压缩下大小增至 40,960 字节。RLE:相同颜色的游程存储为(颜色,计数)。示例 5×5 网格:第一行 3 白 2 黑可记为 (W,3)(B,2)。若图像有大片均匀色块,压缩比会很高。矢量图形以数学方式存储形状,因此相同方块的马赛克可定义为一个带坐标的重复元素,比光栅使用更少数据,展示了表示方法之间的权衡。 Published by TutorHao | Computer Science Revision Series | aleveler.com 更多咨询请联系16621398022(同微信)
10. Artificial Intelligence and Game Playing | 人工智能与游戏博弈
11. Operating System Scheduling and Hospital Resource Management | 操作系统调度与医院资源管理
12. Data Representation and Digital Art | 数据表示与数字艺术
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导