A series of instructions telling a computer how to read a compressed file is called a n

In our previous example, we picked out all the repeated words and put those in a dictionary. To us, this is the most obvious way to write a dictionary. But a compression program sees it quite differently: It doesn't have any concept of separate words -- it only looks for patterns. And in order to reduce the file size as much as possible, it carefully selects which patterns to include in the dictionary.

If we approach the phrase from this perspective, we end up with a completely different dictionary.

If the compression program scanned Kennedy's phrase, the first redundancy it would come across would be only a couple of letters long. In "ask not what your," there is a repeated pattern of the letter "t" followed by a space -- in "not" and "what." If the compression program wrote this to the dictionary, it could write a "1" every time a "t" were followed by a space. But in this short phrase, this pattern doesn't occur enough to make it a worthwhile entry, so the program would eventually overwrite it.

The next thing the program might notice is "ou," which appears in both "your" and "country." If this were a longer document, writing this pattern to the dictionary could save a lot of space -- "ou" is a fairly common combination in the English language. But as the compression program worked through this sentence, it would quickly discover a better choice for a dictionary entry: Not only is "ou" repeated, but the entire words "your" and "country" are both repeated, and they are actually repeated together, as the phrase "your country." In this case, the program would overwrite the dictionary entry for "ou" with the entry for "your country."

The phrase "can do for" is also repeated, one time followed by "your" and one time followed by "you," giving us a repeated pattern of "can do for you." This lets us write 15 characters (including spaces) with one number value, while "your country" only lets us write 13 characters (with spaces) with one number value, so the program would overwrite the "your country" entry as just "r country," and then write a separate entry for "can do for you." The program proceeds in this way, picking up all repeated bits of information and then calculating which patterns it should write to the dictionary. This ability to rewrite the dictionary is the "adaptive" part of LZ adaptive dictionary-based algorithm. The way a program actually does this is fairly complicated, as you can see by the discussions on Data-Compression.com.

No matter what specific method you use, this in-depth searching system lets you compress the file much more efficiently than you could by just picking out words. Using the patterns we picked out above, and adding "__" for spaces, we come up with this larger dictionary:

  1. ask__
  2. what__
  3. you
  4. r__country
  5. __can__do__for__you 

And this smaller sentence: "1not__2345__--__12354"

The sentence now takes up 18 units of memory, and our dictionary takes up 41 units. So we've compressed the total file size from 79 units to 59 units! This is just one way of compressing the phrase, and not necessarily the most efficient one. (See if you can find a better way!)

So how good is this system? The file-reduction ratio depends on a number of factors, including file type, file size and compression scheme.

In most languages of the world, certain letters and words often appear together in the same pattern. Because of this high rate of redundancy, text files compress very well. A reduction of 50 percent or more is typical for a good-sized text file. Most programming languages are also very redundant because they use a relatively small collection of commands, which frequently go together in a set pattern. Files that include a lot of unique information, such as graphics or MP3 files, cannot be compressed much with this system because they don't repeat many patterns (more on this in the next section).

If a file has a lot of repeated patterns, the rate of reduction typically increases with file size. You can see this just by looking at our example -- if we had more of Kennedy's speech, we would be able to refer to the patterns in our dictionary more often, and so get more out of each entry's file space. Also, more pervasive patterns might emerge in the longer work, allowing us to create a more efficient dictionary.

This efficiency also depends on the specific algorithm used by the compression program. Some programs are particularly suited to picking up patterns in certain types of files, and so may compress them more succinctly. Others have dictionaries within dictionaries, which might compress efficiently for larger files but not for smaller ones. While all compression programs of this sort work with the same basic idea, there is actually a good deal of variation in the manner of execution. Programmers are always trying to build a better system.

/en/techsavvy/how-to-print/content/

What is a zip file?

A zip file is a way of grouping, or archiving, multiple files so they act like one file. For example, let's say you want to email a folder of Word documents to someone. You could attach each file individually, but it would take a long time—especially if there are a lot of documents. A better solution would be to put all of the files into a zip file, and then attach the zip file to your email.

A series of instructions telling a computer how to read a compressed file is called a n

Another advantage of zip files is that they are compressed, which means the total file size is smaller. If you're emailing a zip file to someone or posting it to the Web, it takes less time to upload—and your recipients will also be able to download it more quickly.

Some file formats, like MP3s and JPEG images, are already compressed. You can still zip these types of files, but the file size may not get much smaller.

Creating zip files

Whether you're using Windows or macOS, you don't need additional software to create and open zip files. That's because the basic zip file features are built into the operating system.

To create a zip file in Windows:

  1. Select the files you want to add to the zip file.

    A series of instructions telling a computer how to read a compressed file is called a n

    Selecting files

  2. Right-click one of the files. A menu will appear.

    A series of instructions telling a computer how to read a compressed file is called a n

    Right-clicking a file
  3. In the menu, click Send to and select Compressed (zipped) folder.

    A series of instructions telling a computer how to read a compressed file is called a n

    Creating a zip file
  4. A zip file will appear. If you want, you can type a new name for the zip file.

    A series of instructions telling a computer how to read a compressed file is called a n

In Windows, once you've created a zip file you can then add more files to it by dragging them onto the zip file's icon.

A series of instructions telling a computer how to read a compressed file is called a n

To create a zip file in macOS:

  1. Select the files you want to add to the zip file.

    A series of instructions telling a computer how to read a compressed file is called a n

  2. Right-click one of the files. If right-clicking is not enabled, you can hold the Control key and then click. A menu will appear.

    A series of instructions telling a computer how to read a compressed file is called a n

  3. In the menu, click Compress (the number will vary depending on how many files you have selected).

    A series of instructions telling a computer how to read a compressed file is called a n

  4. A zip file will appear. By default, the file name will be Archive.zip.

    A series of instructions telling a computer how to read a compressed file is called a n

  5. If you want, you can type a new name for the zip file.

    A series of instructions telling a computer how to read a compressed file is called a n

In macOS, once you've created a zip file you cannot add more files to it. If you need to add files, you will need to create a new zip file that contains all of the files you want.

Adding a password to your zip file

Some people prefer to use zip file programs such as 7-Zip, PeaZip, and StuffIt. These programs have additional features, like password protection. If you add a password to your zip file, it's important to tell recipients what the password is so they can open it.

A series of instructions telling a computer how to read a compressed file is called a n

Opening zip files

To open a zip file in Windows:

Windows treats zip files just like folders. You can open a zip file, move files in and out of it, and open individual files just like you would if they were in a folder.

  1. Double-click the zip file.

    A series of instructions telling a computer how to read a compressed file is called a n

  2. The zip file will open. You can now double-click any file to open it.

    A series of instructions telling a computer how to read a compressed file is called a n

Because Windows makes it easy to work with zip files, there's generally no need to unzip them. However, if you would prefer to unzip them you can simply right-click the zip file's icon and select Extract All.

A series of instructions telling a computer how to read a compressed file is called a n

To open a zip file in macOS:

Opening a zip file in macOS is slightly different from Windows. Instead of opening the zip file directly, it will unzip the files and place them in a new folder. You can then open the folder to access individual files.

  1. Double-click the zip file.

    A series of instructions telling a computer how to read a compressed file is called a n

  2. A folder will be created with the same name as the zip file. You can double-click the folder to open it.

    A series of instructions telling a computer how to read a compressed file is called a n

  3. You can now double-click any file to open it.

    A series of instructions telling a computer how to read a compressed file is called a n

/en/techsavvy/tech-lifehack-vines/content/