Bird
Raised Fist0

Comparing SCAN and C-SCAN algorithms, what is the main difference in their time complexity and why?

medium🪤 Complexity Trap Q6 of Q15
Operating Systems - Disk Scheduling - SSTF, SCAN, C-SCAN
Comparing SCAN and C-SCAN algorithms, what is the main difference in their time complexity and why?
ABoth have O(N) time complexity, but C-SCAN may have higher average wait due to head jumping back
BSCAN has O(N^2) due to reversing direction, C-SCAN is O(N) because it moves in one direction only
CC-SCAN has O(log N) complexity using circular buffers, SCAN is O(N) linear scan
DSCAN is O(N) but C-SCAN is O(N^2) because of the jump back to start
Step-by-Step Solution
Solution:
  1. Step 1: Understand SCAN and C-SCAN operations

    Both algorithms scan requests linearly in one direction per cycle.
  2. Step 2: Analyze time complexity

    Both process N requests in O(N) time per cycle.
  3. Step 3: Consider head movement differences

    C-SCAN jumps back to start without servicing requests on return, possibly increasing wait times but not complexity.
  4. Final Answer:

    Option A -> Option A
  5. Quick Check:

    Both linear scans -> O(N), C-SCAN's jump affects wait, not complexity [OK]
Quick Trick: SCAN and C-SCAN both scan linearly -> O(N) time [OK]
Common Mistakes:
MISTAKES
  • Confusing jump back with extra complexity
  • Assuming reversing doubles complexity
Trap Explanation:
PITFALL
  • Candidates mistake physical head jumps for increased algorithmic complexity.
Interviewer Note:
CONTEXT
  • Tests understanding of complexity vs physical head movement effects.
Master "Disk Scheduling - SSTF, SCAN, C-SCAN" in Operating Systems

2 interactive learning modes - each teaches the same concept differently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Operating Systems Quizzes