In digital electronics signals usually take only two different levels.
A logic gate is an idealized or physical device implementing a Boolean function like AND or OR, to perform a logical operation on one or more logic inputs and produces a single logic output.
Logic gates are primarily implemented using diodes or transistors
A flip-flop or latch is a circuit that has two stable states and can be used to store state information. The circuit can be made to change state by signals applied to one or more control inputs and will have one or two outputs. Flip-flops and latches are a fundamental building block of digital electronics systems used in computers, communications, and many other types of systems.
Flip-flops and latches are used as data storage elements. Such data storage can be used for storage
of state. The output and next state depend not only on its current input, but also on its current
state (and hence, previous inputs.)
Multiplexer and De-multiplexer
A multiplexer or mux is a device that selects one of several input signals and forwards the selected input into a single line. They convert multiple inputs to a single output and are used to increase the amount of data that can be sent over the network within a certain amount of time and bandwidth.
It makes possible for several signals to share one device or resource, for example one communication line, instead of having one device per input signal.
A demultiplexer (or demux) is a device which takes a single input signal and selects one of many data-output-lines, which is connected to the single input. A multiplexer is often used with a complementary demultiplexer on the receiving end.
An electronic multiplexer can be considered as a multiple-input, single-output switch, and a demultiplexer as a single-input, multiple-output switch
Both are made using logic gates and using Boolean algebra.