Science Fair Projects Ideas - Buffer gap

All Science Fair Projects

      

Science Fair Project Encyclopedia for Schools!

  Search    Browse    Forum  Coach    Links    Editor    Help    Tell-a-Friend    Encyclopedia    Dictionary     

Science Fair Project Encyclopedia

For information on any area of science that interests you,
enter a keyword (eg. scientific method, molecule, cloud, carbohydrate etc.).
Or else, you can start by choosing any of the categories below.

Buffer gap


The buffer gap technique is used to store text compactly in text editors, where most changes to the text occur at or near the current location of the cursor. The text is stored in a large buffer in two contiguous segments, with a gap between them for inserting new text. Moving the cursor involves copying text from one side of the gap to the other (sometimes this process is delayed until the next operation that changes the text). Insertion adds new text at the end of the first segment. Deletions increase the size of the gap.

The advantage of using a buffer gap over more sophisticated data structures is that the text is represented simply as two literal strings, which take very little extra space and which can be searched and displayed very quickly. The disadvantage is that operations on very large files—particularly those that involve many changes at different locations in the file or that fill up the gap, requiring a new gap to be created—require recopying most of the text. The use of buffer gaps in practice is based on the assumption that such recopying occurs rarely enough that its cost can be amortized over the more common cheap operations.

A buffer gap is used in most Emacs editors.

Below are some examples of operations with buffer gaps. The gap is represented pictorially by the empty space between the square brackets. This representation is a bit misleading: in a typical implementation, the endpoints of the gap are tracked using pointers, and the contents of the gap are ignored; this allows, for example, deletions to be done by adjusting a pointer without changing the text in the buffer.

Initial state:

This is the way[                    ]out.

User inserts some new text:

This is the way the world began [   ]out.

User moves cursor after "out":

This is the way the world began out[   ].

User deletes "out":

This is the way the world began[       ].
09-23-2007 01:00:40
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details
Science kits, science lessons, science toys, maths toys, hobby kits, science games and books - these are some of many products that can help give your kid an edge in their science fair projects, and develop a tremendous interest in the study of science. When shopping for a science kit or other supplies, make sure that you carefully review the features and quality of the products. Compare prices by going to several online stores. Read product reviews online or refer to magazines.

Start by looking for your science kit review or science toy review. Compare prices but remember, Price $ is not everything. Quality does matter.
Science Fair Coach
What do science fair judges look out for?
ScienceHound
Science Fair Projects for students of all ages
All Science Fair Projects.com Site
All Science Fair Projects Homepage
Search | Browse | Links | From-our-Editor | Books | Help | Contact | Privacy | Disclaimer | Copyright Notice