---
title: "DDA versus Bresenham line algorithm"
subject: "Computer Graphics"
chapter: 2
key: "semester_5/computer_graphics:dda-vs-bresenham-line"
source: https://www.bctengineer.com/q/semester_5/computer_graphics/dda-vs-bresenham-line
site: BCT Engineering
---

# DDA versus Bresenham line algorithm

Computer Graphics · Chapter 2: Scan-Conversion

- Asked in: 2070 Asar, 3 marks; 2070 Chaitra, 2 marks; 2068 Bhadra (old course), 3 marks; 2078 Bhadra, 3 marks; 2076 Chaitra, 2 marks; 2075 Chaitra, 2 marks (asked 6 times)
- Video: [DDA vs Bresenham Line Drawing Algorithm | Difference Explained with Example (Computer Graphics)](https://www.youtube.com/watch?v=Su-xS5js4-k) — Simple Snippets
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/computer_graphics/dda-vs-bresenham-line
- Whole chapter: https://www.bctengineer.com/md/semester_5/computer_graphics/chapter-2

## Question

Differentiate between the DDA and Bresenham's line drawing algorithms: what are the demerits of DDA and how does Bresenham's algorithm address them (advantages of Bresenham's algorithm)?

## Short answer

DDA uses floating-point arithmetic and rounding, causing slow speed and accumulated error. Bresenham’s algorithm uses only integer addition/subtraction with a decision parameter p, no rounding, no error accumulation, making it faster and hardware-friendly.

## Answer

| Point | DDA | Bresenham's |
|---|---|---|
| Arithmetic | Floating-point (slope m, increments) | Integer only (additions, subtractions, shifts) |
| Rounding | Round() needed at every step | No rounding; uses a decision parameter |
| Speed | Slower | Faster |
| Accuracy | Rounding errors accumulate (drift) on long lines | Accurate; error does not accumulate |
| Pixel choice | Rounds the computed y to the nearest integer | Chooses the pixel closest to the true line using the sign of p |
| Hardware | Hard to implement | Easy to implement in hardware |
| Operations | One division for the increments, then a floating-point addition and rounding per step | Integer additions/subtractions only |

#### Demerits of DDA
- Uses floating-point operations and rounding at every step, which is slow.
- Accumulated round-off error in x and y makes the pixel positions drift from the true line, especially for long lines.
- Needs a division to find the slope or step size.

#### How Bresenham's algorithm addresses them (advantages)
- Uses only integer arithmetic: decision parameter p_0 = 2Δy − Δx, with p_k+1 = p_k + 2Δy or p_k + 2Δy − 2Δx.
- No rounding and no accumulated error: the sign of p_k gives the closest pixel exactly.
- Faster and easy to implement in hardware, so it is used by most graphics systems.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Bresenham uses
   A. floating-point
   B. trig
   C. square roots
   D. integer arithmetic only
   Answer: D. No rounding. (Key point: Arithmetic)

2. A DDA demerit is
   A. accumulated round-off error causing drift
   B. integer only
   C. exact pixels
   D. no division
   Answer: A. Rounding at every step. (Key point: DDA demerit)

3. Bresenham initial parameter is
   A. dy - 2dx
   B. 2dy - dx
   C. 2dx - dy
   D. dx + dy
   Answer: B. p0 = 2dy - dx. (Key point: Bresenham p0)

## Related in Computer Graphics

- [Compare DDA/Bresenham; midpoint ellipse](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Acompare-dda-bresenham-midpoint-ellipse) — Computer Graphics, chapter 2
- [Write Bresenham's line algorithm](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Abresenham-line-algorithm) — Computer Graphics, chapter 2, asked 3×
- [DDA algorithm with advantages](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Adda-algorithm-detail) — Computer Graphics, chapter 2
- [Bresenham's algorithm for all slopes](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Abresenham-all-slopes) — Computer Graphics, chapter 2
- [Bresenham: line (25,20) to (15,10)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Adigitize-line-25-20-15-10) — Computer Graphics, chapter 2
- [Bresenham: line (20,10) to (30,18)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Adigitize-line-20-10-30-18) — Computer Graphics, chapter 2, asked 4×

## Related in other subjects

- [Data types and classification of algorithms](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Adata-types-classify-algorithms) — Data Structure and Algorithm, chapter 1
- [Secant algorithm, versus false position](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Asecant-pseudocode-vs-false-position) — Numerical Method, chapter 2
- [Algorithm versus pseudo-code](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aalgorithm-vs-pseudocode) — Computer Programming, chapter 2
- [Forward vs reverse engineering merits and demerits](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Aforward-reverse-engineering-merits) — Object Oriented Analysis and Design, chapter 4, asked 3×
