2-SAT

Converting logic constraints into implication graphs. Using SCCs to determine satisfiability and construct valid assignments.

51 lessons
147 min

Lessons

1. Intro

(Logic meets graphs)

3m

2. What is SAT

(Boolean satisfiability)

3m

3. The 2-SAT Restriction

(Exactly two variables)

3m

4. Variables and Negations

(True or false)

3m

5. Implication Graphs

(Clauses become edges)

3m

6. Converting OR to Implication

(The core transformation)

3m

7. Why This Works

(Logic equivalence)

3m

8. Example Conversion

(Building the graph)

3m

9. Quiz: Implication Graph Construction

Knowledge check

2m1 problems

10. The SCC Connection

(Satisfiability condition)

3m

11. Why Same SCC Fails

(Contradiction proof)

3m

12. Finding an Assignment

(Using SCC order)

3m

13. Why Topological Order Works

Avoiding forced contradictions

3m

14. Algorithm Summary

(Four steps)

3m

15. Complexity Analysis

(Linear time)

3m

16. Quiz: Satisfiability Check

Knowledge check

2m1 problems

17. Problem - Giant Pizza

(Read statement)

3m1 problems

18. Modeling as 2-SAT

(Toppings as variables)

3m

19. Building the Implication Graph

(Converting constraints)

3m

20. Checking Satisfiability

(SCC test)

3m

21. Constructing the Assignment

(SCC topological order)

3m

22. Giant Pizza - Implementation

(C++ solution)

3m1 problems

23. Edge Case - All Positive

(Simplest satisfiability)

3m

24. Edge Case - Contradiction

(Same topping opposite signs)

3m

25. Lessons from Giant Pizza

(Recognition and modeling)

3m

26. Quiz: Assignment Construction

Knowledge check

2m1 problems

27. Constraint Pattern - At Most One

(Mutual exclusion)

3m

28. Constraint Pattern - Exactly One

(One must be true)

3m

29. Constraint Pattern - If-Then

(Implication directly)

3m

30. Multiple Clauses on Same Variables

(Combining constraints)

3m

31. Quiz: Clause Conversion

Knowledge check

2m1 problems

32. Problem - Course Scheduling

(Time slot assignment)

3m

33. Modeling Scheduling

(Binary time slots)

3m

34. Scheduling Solution

(SCC assignment)

3m

35. Lessons from Scheduling

(Binary choices)

3m

36. When to Use 2-SAT

(Problem recognition)

3m

37. Extensions Beyond 2-SAT

(Harder problems)

3m

38. Common Mistakes

(Avoiding pitfalls)

3m

39. Debugging 2-SAT Solutions

(Finding errors)

3m

40. Quiz: Debugging 2-SAT

Knowledge check

2m1 problems

41. Vocabulary - Clause

(OR of literals)

3m

42. Vocabulary - Literal

(Variable or negation)

3m

43. Vocabulary - Satisfiable

(Valid assignment exists)

3m

44. Vocabulary - Implication

(If-then statement)

3m

45. Practice Problem 1

(CSES - Giant Pizza)

3m

46. Practice Problem 2

(Graph coloring variant)

3m

47. Practice Problem 3

(Time slot assignment)

3m

48. Visualization Tip

(Drawing the graph)

3m

49. Connection to Other Topics

(Graph algorithms unite)

3m

50. Quiz: Recognizing 2-SAT

Knowledge check

2m1 problems

51. Section Recap

(What you learned)

3m

Practice Problems

1.
Giant PizzaCSEShard
2.
The Door ProblemCodeforceshard
3.
Catowice CityCodeforceshard
4.
Radio StationsCodeforceshard

Ready to start learning?

Access all 51 lessons with interactive content and progress tracking.