The replacement is stored
In compression, the algorithm looks for repeating patterns in the source alphabet and encodes these patters as new symbols in a translated alphabet.
The new alphabet is composed of symbols that are longer (composed of more bits) than the symbols in the source alphabet.The compression arises when repeating patterns in the old alphabet are replaced by a single symbol in the new alphabet.The replacement is stored in a dictionary that contains all mappings of the old alphabet patterns into the new alphabet symbols.
The decompression algorithm simply does the reverse process of the compression algorithm.
The algorithm takes a look at the input stream in the new alphabet and looks up the dictionary for its corresponding pattern in the old alphabet.
Unlike Huffman coding, LZW compression does not use probability analysis and computation on the source data, needing only to look at repeating patterns in the source alphabet. LZW works best on streams that contain multiple repeating patterns such as text files.
Huffman coding on the other hand works best on streams where there is a disparity in relative frequencies between symbols. In LZW, a dictionary is used to map patterns in the old alphabet to symbols in the new alphabet, the dictionary being constructed from repeating patterns.
In Huffman, symbol mappings are based on the frequencies of the symbols in the source alphabet. Additionally, the bit length of the new symbols in LZW is constant while the bit length for the new symbols in Huffman is variable, depending on the frequency of the source symbols.
Wireless Mobile Ad-hoc Networks (MANET) and Wireless Sensor Networks are two similar kinds of wireless technology. A MANET is a self-configuring network the result being an arbitrary topology. There is no fixed infrastructure between the nodes and their only relationship to each other is their proximity to one another.
However, that may not be true for sensor networks. Some sensor network protocols specify a specific topology. In the case of IEEE 802.15.4, it allows for two kinds of topologies, a ring topology and a peer to peer topology.
Another difference is complexity. The nodes of sensor networks are generally much simpler than in MANETs. Sensor nodes typically include only a transceiver module for communication, a sensor and a microcontroller.
This is because of the relatively simpler uses for the sensor such as data collection and gathering. In contrast, nodes of a MANET will generally be more complex, being made up of complete laptops, PDAs or other high level communication devices.
A third difference is in the data rates. Sensor networks are generally low data rate systems while MANETs have higher data rates. Bit rates in MANETs like 802.11 are measured in Mbps while those in 802.15.4 and Zigbee are in kbps only. Fourth is power consumption, MANET nodes are designed to be mains powered or only to be reliant on batteries for a short amount of time (generally a few hours).
On the other hand, sensor networks will generally use low power components to stretch the power of the battery for weeks or months on end. Lastly, in MANETs, nodes are envisioned to be constantly sending data to one another while in sensor networks, nodes are expected to be in a sleep or quiet mode for most of the time.
This is due to the amount of data exchanged in MANETs compared to sensor networks which may only need to throw data to the server on specified times.
If we take the example of the ZigBee sensor network protocol, we can see three layers from the OSI model at work in the ZigBee protocol. In the ZigBee protocol, its uses the IEEE 802.15.4 standard for the PHY and MAC portion of the DLL layer. The ZigBee specification on the other hand serves as the upper layers for the wireless sensor network.