Loading...
(function(){<br />
let canvas = document.createElement('canvas'),<br />
ctx = canvas.getContext('2d'),<br />
w = canvas.width = innerWidth,<br />
h = canvas.height = innerHeight,<br />
particles = [],<br />
properties = {<br />
bgColor : 'rgba(17, 17, 19, 1)',<br />
particleColor : 'rgba(255, 40, 40, 1)',<br />
particleRadius : 3,<br />
particleCount : 60,<br />
particleMaxVelocity : 0.5,<br />
lineLength : 150,<br />
particleLife : 6,<br />
};<br />
<br />
document.querySelector('body').appendChild(canvas);<br />
<br />
window.onresize = function() {<br />
w = canvas.width = innerWidth;<br />
h = canvas.height = innerHeight;<br />
}<br />
<br />
class Particle {<br />
constructor() {<br />
this.x = Math.random()*w;<br />Loading...
This is a short summary of the section about sets in the book Computer Science Guide by William Springer.
A set is an unordered collection of unique items.
There are three main operations, each of which takes two sets as arguments and returns another set as a result.
Union(A, B) — the union of sets — is the set containing every element that belongs to at least one of the sets A and B. The union is usually denoted as A ∪ B.

Intersection(A, B) — the intersection of sets — is the set of elements contained in both A and B, denoted as A ∩ B.

Difference(A, B) — the set difference — denoted as A − B — is the set containing all elements that are in A but not in B.

There is also a Subset(A, B) operation, which returns a boolean value. It returns true if A is a subset of B.
A proper subset means that A is a subset of B and A is not equal to B.
If A ⊆ B and B ⊆ A, then A = B.
Example of an integer set: {4, 7, 12, 18, 2004}
In JavaScript, a set is represented by the Set object.
A multiset allows duplicate elements: it stores multiple copies of the same value or keeps a count of how many times a value appears in the set.
A partially ordered set is one in which some elements are ordered relative to each other. For a binary relation (an operation that works with two operands) ≤ between elements b and c, it may be true that b ≤ c, or c ≤ b, or there may be no relation between b and c.
A totally ordered set is one in which all elements are comparable using ≤ — for any two elements f and g, either f ≤ g or g ≤ f.
For such a relation to hold, it must be:
For example, let ≤ mean the relation “is a descendant of”, where by definition every person is a descendant of themselves. This relation is antisymmetric (if I am your descendant, you cannot be my descendant) and transitive (if I am your descendant and you are a descendant of my grandfather, then I am also a descendant of my grandfather). This is a partial, not total, order because two people may be unrelated in terms of ancestry.
A heap is a partially ordered multiset.