- Home
- /
- CS Thinking
- /
- Mistakes
- /
- Computational Thinking
Common Mistakes in Computational Thinking
160 common pitfalls across 40 concepts, including 40 recurring stuck points
These are the pitfalls students hit across all 40 computational thinking concepts, from Algorithm, Decomposition and Pattern Recognition onward. Each entry names the concept it comes from, so you can tell a slip from a genuine gap and go straight to the explanation.
Algorithms must work for all valid inputs, not just specific examples.
Writing steps that are ambiguous or assume human judgment the computer cannot replicate
Forgetting to handle edge cases such as empty input or extreme values
Creating an algorithm that works for one example but fails on other valid inputs
The parts must be truly independent or have clear dependencies.
Splitting a problem into parts that are still too large or too intertwined to solve independently
Forgetting to plan how the sub-solutions will be recombined into the final answer
Over-decomposing into too many tiny parts, creating unnecessary complexity in integration
Correlation isn't causation—patterns can be coincidental and misleading without careful testing.
Assuming a pattern found in a few examples always holds universally
Confusing correlation with causation when spotting trends in data
Overlooking exceptions or edge cases that break the pattern
Too much abstraction loses important information; too little is overwhelming.
Over-abstracting and removing details that turn out to be important for correctness
Under-abstracting and keeping so many details that the model is as complex as the original problem
Confusing abstraction with vagueness—a good abstraction is precise about what it exposes and what it hides
Some steps can't be reordered; others can. Understanding dependencies is key.
Placing a statement that uses a variable before the statement that initializes it
Assuming statements run simultaneously when they actually execute one at a time
Reordering steps without checking whether later steps depend on earlier results
Conditions must be unambiguous—what happens when temperature = 30?
Using assignment (=) instead of comparison (==) in the condition, which silently succeeds in some languages
Forgetting to handle the else case, leaving unexpected inputs with no defined behavior
Writing overlapping conditions in if/else-if chains so that the wrong branch executes
The loop must have a way to stop—every iteration should progress toward the stopping condition.
Forgetting to update the loop variable, causing an infinite loop that never terminates
Off-by-one errors where the loop runs one too many or one too few times
Modifying the collection being iterated over during the loop, causing skipped or duplicate elements
= means 'assign' not 'equals'. x = x + 1 is valid (not a paradox).
Using a variable before assigning it a value, causing an undefined or null reference error
Choosing vague variable names like 'x' or 'temp' that make code hard to understand later
Confusing the assignment operator (=) with the equality comparison operator (==)
'5' (text) and 5 (number) are different—some languages convert automatically, some don't.
Assuming '5' (a string) and 5 (an integer) are the same and can be used interchangeably
Forgetting that dividing two integers truncates in languages such as C and Java (7 / 2 gives 3, not 3.5), while Python 3 and JavaScript give 3.5
Not converting user input from string to the appropriate type before performing calculations
AND requires both true. OR requires at least one true. NOT flips the value.
Confusing AND with OR—AND is stricter (both must be true), OR is more permissive (either suffices)
Forgetting De Morgan's laws: NOT (A AND B) equals (NOT A) OR (NOT B)
Neglecting operator precedence—NOT binds tighter than AND, which binds tighter than OR
Defining a function doesn't run it—you must call the function.
Defining a function but forgetting to call it, wondering why nothing happens
Making functions that do too many things instead of one well-defined task
Confusing parameters (placeholders in the definition) with arguments (actual values passed in the call)
Parameter (in definition) vs. argument (in call)—often used interchangeably.
Passing arguments in the wrong order, causing the function to receive incorrect values
Confusing parameters (defined in the function signature) with arguments (passed at the call site)
Forgetting to pass a required parameter, causing a runtime error or unexpected default behavior
Most languages index from 0, not 1. The last element of a 3-item array is at index 2.
Accessing an index that is out of bounds (e.g., index 5 in a 5-element array, which only has indices 0-4)
Forgetting that arrays are zero-indexed, leading to off-by-one errors
Confusing the array length with the last valid index (length 5 means last index is 4)
The bug might not be where the error appears—trace backward.
Making random changes hoping to fix the bug instead of systematically isolating the cause
Fixing the symptom instead of the root cause, which leads to the bug reappearing in different forms
Not testing the fix thoroughly, accidentally introducing new bugs while fixing the original one
Input needs validation—users may enter unexpected or invalid values that crash the program.
Not validating user input, leading to crashes or security vulnerabilities when unexpected data is entered
Forgetting that input from the keyboard is usually a string and needs type conversion for numeric use
Mixing up the order of input prompts and output displays, confusing the user
Each position is a power of 2 (1, 2, 4, 8 ...). Reading right-to-left: position 0 = 1, position 1 = 2, etc.
Reading binary digits left-to-right instead of right-to-left when assigning powers of 2
Forgetting that position 0 (rightmost) has value , not
Confusing binary arithmetic carries (1 + 1 = 10 in binary, not 2)
KB, MB, GB are each other, not (though marketing often uses 1000).
Confusing bits (b) with bytes (B) in speed and storage measurements
Forgetting that bits represent values, not values
Mixing decimal units (KB = 1000 bytes) with binary units (KiB = 1024 bytes), such as expecting a '500 GB' drive to show as 500 GiB rather than about 466 GiB
Without a base case, recursion never ends—the program crashes with a stack overflow error.
Forgetting the base case, causing infinite recursion and a stack overflow error
Writing a recursive case that does not make the problem smaller, so the base case is never reached
Not trusting the recursion—trying to trace every level mentally instead of trusting that the recursive call returns the correct result for the smaller problem
Big O ignores constant factors— and are both because the growth rate is what matters.
Confusing Big O (upper bound) with exact running time
Ignoring nested loops when counting operations
Assuming a faster algorithm is always better (ignoring constant factors for small inputs)
Binary search requires sorted data—but is much faster than linear search.
Applying binary search to unsorted data, which gives incorrect results
Not handling the case where the target value is not found in the collection
Using linear search on large sorted datasets when binary search would be orders of magnitude faster
Stable sort preserves original order of equal elements; unstable doesn't.
Using an algorithm like bubble sort on large datasets when an algorithm is available
Not specifying the sort order clearly, leading to confusion about ascending vs. descending results
Forgetting that stable vs. unstable sorting matters when elements have equal keys but different associated data
Events can occur in any order—the program must handle any sequence.
Forgetting to register the event handler, so the event fires but nothing happens
Assuming events occur in a predictable order when users can interact in any sequence
Writing event handlers that take too long to execute, making the program feel unresponsive
Different representations have trade-offs (quality vs. size).
Assuming all text uses the same encoding—ASCII, UTF-8, and UTF-16 represent characters differently
Forgetting that higher-quality representations (more bits per sample) produce larger files
Confusing the data itself with its representation—the same image can be stored as PNG, JPEG, or BMP with different trade-offs
Simulations are only as good as their underlying assumptions—garbage in, garbage out.
Trusting simulation results without validating the model against known real-world data first
Including too many variables, making the simulation complex and slow without improving accuracy
Ignoring that small errors in assumptions can compound over many simulation steps, producing wildly inaccurate long-term predictions
Test edge cases: empty input, zero, maximum values, unexpected types.
Only testing the happy path (normal inputs) and neglecting edge cases and error conditions
Writing tests that depend on each other's execution order instead of being independent
Assuming that passing all tests means the program is bug-free—testing can only show the presence of bugs, not their absence
Modules should have minimal dependencies on each other (loose coupling).
Creating modules that are too large and do too many things (low cohesion)
Having modules depend heavily on each other's internal details (tight coupling)
Not defining clear interfaces between modules, leading to spaghetti dependencies
Binary search only works on sorted data — applying it to unsorted data gives wrong results.
Applying binary search to an unsorted list, which produces incorrect results
Computing the midpoint as (low + high) / 2, which can cause integer overflow in languages with fixed-size integers, such as Java or C—use low + (high - low) / 2 instead
Getting the boundary updates wrong (using mid instead of mid+1 or mid-1), causing infinite loops
Linear search works on any list; binary search is faster but requires sorted data.
Using linear search on large sorted datasets when binary search would be dramatically faster
Forgetting to handle the case where the element is not found, leading to index errors
Stopping at the first match when you need to find all occurrences of the target value
Merge sort uses extra memory proportional to the input size (unlike in-place sorts).
Forgetting that merge sort requires extra memory for the temporary arrays during merging
Incorrectly implementing the merge step by not handling the case when one half is exhausted before the other
Confusing merge sort's guaranteed with quicksort's average but worst-case
Bubble sort is O(n²) — avoid it for large data; use merge sort or quick sort instead.
Not optimizing with an early exit—if a pass makes no swaps, the list is already sorted and you can stop
Comparing elements beyond the sorted portion at the end of the array, wasting comparisons
Using bubble sort for large datasets when algorithms are available and dramatically faster
A good general rule must fit all intended cases, not just the first two examples you notice.
Building a rule from too few examples and missing exceptions
Writing a rule that is too specific to one example instead of using variables
Ignoring the conditions under which the general rule is supposed to work
You still need a clear combine step. Splitting a problem is not enough if you cannot reconstruct the final answer.
Splitting the problem without reducing its size enough to reach a base case
Forgetting the combine step after the recursive calls finish
Using divide and conquer when the subproblems are not actually similar to the original problem
Logic errors are often the hardest because the program still runs, so the bug is less obvious.
Calling every wrong answer a syntax problem even when the code runs
Fixing one runtime crash without checking whether a deeper logic problem remains
Ignoring compiler or interpreter messages that already identify the error category
Resolution and file format are different ideas. Two images can have the same resolution but different file sizes.
Thinking a larger displayed image must contain more pixels
Confusing image resolution with compression format
Ignoring that more color depth increases file size
A higher sample rate is not the same as a louder sound. It means the waveform is measured more often.
Confusing sample rate with volume
Assuming compressed audio stores the exact same data as the original
Ignoring that stereo audio stores two channels, not one
Pseudo-random does not mean useless. It means the values come from an algorithm instead of true physical randomness.
Assuming pseudo-random numbers are truly unpredictable in every context
Using random values without checking whether the intended distribution is uniform
Forgetting that the same seed can recreate the same sequence
A model is not supposed to include everything. Its job is to include the right things.
Adding too many details that do not help answer the question
Forgetting to state the assumptions behind the model
Treating model output as perfect truth instead of an approximation
Smaller is not always better. You must decide whether exact recovery matters.
Assuming every compressed file can be restored perfectly
Ignoring the quality loss caused by repeated lossy compression
Comparing compressed files without checking whether they use the same format and settings
AND requires ALL conditions true; OR only requires ONE — easy to confuse.
Confusing AND with OR in complex conditions, reversing the intended logic
Forgetting operator precedence—NOT binds before AND, which binds before OR—leading to unexpected results without parentheses
Using natural language intuition that fails in code: 'x is 5 or 10' must be written as 'x == 5 OR x == 10', not 'x == 5 OR 10'
With n variables there are 2ⁿ rows — 3 variables means 8 rows, 4 means 16.
Forgetting to include all rows, missing some input combinations
Evaluating compound expressions without respecting operator precedence (NOT before AND before OR)
Assuming two expressions are equivalent after checking only a few rows instead of all possible combinations