Logical Operator Laws - Computer Science - Lecture Notes, Study notes of Computer Science

This is introductory course for computer science. Its about basic concepts involving in computer programming, structure and working. Key points in this lecture handout are: Logical Operator Laws, Sorting, Returned, Sorting Algorithms, Frequent Operation

Typology: Study notes

2012/2013

Uploaded on 09/28/2013

noob
noob 🇮🇳

4.4

(25)

105 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lecture Notes CPSC 121 (Fall 2012)
Today ...
Quiz 7
Logical operator laws
Sorting
S. Bowers 1 of 3
pf3

Partial preview of the text

Download Logical Operator Laws - Computer Science - Lecture Notes and more Study notes Computer Science in PDF only on Docsity!

Today ...

  • Quiz 7
  • Logical operator laws
  • Sorting

Logical Operator Review ... and Laws

What is returned?

  1. "ham" and ("spam" or "eggs")
  2. "ham" or ("spam" and "eggs")

What about for these?

  1. ("ham" and "spam") or ("ham" and "eggs") Distributive Law
  2. ("ham" or "spam") and ("ham" or "eggs") Distributive Law

In general:

  1. x and (y or z) ≡ (x and y) or (x and z)
  2. x or (y and z) ≡ (x or y) and (x or z)

What about for these?

  1. not ("ham" or "spam")
  2. (not "ham") and (not "spam") DeMorgan’s Law

In general:

  1. not (x or y) ≡ (not x) and (not y)
  2. not (x and y) ≡ (not x) or (not y)

For example:

  • not (c == "red" or c == "blue") ≡ c != "red" and c != "blue"
  • and different than: c != "red" or c != "blue" ... common mistake