Friday, March 20, 2020

Explain the different data structures that are avaliable to computer programmers, giving examples of their use, and reasons why they would be chosen instead of others Essay Example

Explain the different data structures that are avaliable to computer programmers, giving examples of their use, and reasons why they would be chosen instead of others Essay Example Explain the different data structures that are avaliable to computer programmers, giving examples of their use, and reasons why they would be chosen instead of others Essay Explain the different data structures that are avaliable to computer programmers, giving examples of their use, and reasons why they would be chosen instead of others Essay Essay Topic: The Chosen Dats structures are one of the most common principles computer operation, the ability to locate, add or delete data is common and used as soon as you turn on your computer system. The fundamental reason for using data structures is that it uses efficient ways of carrying out the above operations when large amounts of data are involved in the calculations. Lists, string, stacks, queues, arrays trees are some of the most common data structures. They have been adapted from many pre-computing methods, as a queue in its principal is exactly the same as a queue in a shop for items, for example. Linear List A linear list could be considered a one-dimensional array. The list of numbers form what is called a linear list, ie. 5.1, 1.2, .5.9, .3.6, .4.7. Those numbers on themselves are meaningless data, however with a context it becomes information, for example 5.1 is the 0-60 time of a car would be a suitable context. The data in the list has to have a numeric amount of =0. Data can be stored inside computers as a linear list. If an item has to be added, then the item of data in the middle of the list, then all the data after the item needs to be inserted after the item to make way for the new item of data. Algorithms could be developed to do this, however in reality they would not be used, and would prove to be not efficient if large amounts of data were involved. The pointer system is the preffered system to be used, which shows how newer data structures enable the user to insert and delete items of data without having to move any existing data. However this is not the most efficient way of dealing with large amounts of data. Stacks A stack is a method used to insert and delete items from a linear list. The concept of a stack is of fundamental importance in computing as it is used in so many different applications, adnt hius principle of a stack is illustrated. E.g. The numbers in the list: 23, 54, 10 90. If the numbers were set out vertically, the list would look like: 23 54 10 90 If 77 was added to the stack when it is pushed on top of the stack. The stack now looks like this: 77 23 54 10 90 If an item is to be removed, is it said to be popped off the stack in the last number in first number out (LIFO last in first out). Often machine code programming involved push and pop as mnemonics for the same purpose. In reality this system works within a computer memory using a pointer system, so that is points to a memory location inside the computer that indicates the top of the stack. If the pointer is ued iin this way then it gains the name stack pointer. Queues A queue is very simmilar I principle to how a stack operates. A queue is often called a FIFO stack (First in First out). The operation of the queue is the same as the operation of a normal queue. (if you were first into a shop you would get server first). When the data has been processed and the first operation has been used (start pointer) the stack does not shift up, just the pointers are moved. This therefore acts as a circular list, so when all the items have been popped and some more pushed on, the procedure is started again from the top using three pointers. The pseudocode to delete some data from a queue could be shown as the following: PROCEDURE INSERT(Size, Start_Pointer, Stop_pointer, Data) (*is queue full?*) IF start_pointer = 1 AND Stop_Pointer = Size OR Start_Pointer = Stop_Pointer + 1 THEN PRINT Queue is already full EXIT PROCEDURE ENDIF (*Check to see if queue is empty*) IF Start_pointer = 0 THEN (*initialise queue*) SET Start_pointer = 1 and SET Stop_pointer = 1 (*Queue not empty, update pointers*) ELSE IF Stop_pointer = Size THEN SET Stop_pointer = 1 (*Put stop_pointer back to beginning*) ELSE SET Stop_pointer = Stop_pointer + 1 (*Update stop_pointer*) ENDIF ENDIF QUEUE(Stop_pointer) = Data (*Store data in queue*) END PROCEDURE Arrays An array is ordering of data elements so that information can be extracted from them. The size of an array depends on the number of rows and columns. Most high level languages allow many more than two or three dimensional arrays, however much memory is consumed for multi-dimensional arrays. Eg. A 5-D array containing 10 elements in each D would require: 10 X 10 X 10 X 10 X 10 = 100,000 locations. (if each number could be scored in one location). Arrays must be represented in computers as a linear list ( a 1-D array). To represent an array in a computers memory requires mapping of each element of the array to the corresponding locations that will score the array. The 3 X 4 array with an identifies, T. eg. 10 21 37 31 T = 35 22 14 66 13 82 26 94 Using row-by-row mapping, this array is shown as: (1,1) (1,2) (1,3) (1,4) (2,1) (2,2) (2,3) (2,4) (3,1) (3,2) (3,3) (3,4) T 10, 21, 37, 31, 35, 22, 14, 66, 13, 82, 26, 94 Linked Lists In a linked list the structure of the data does not necessarily reflect the way in which the data is stored in the computers memory locations. A linked list uses pointers, where a pointer is simply a number stored in memory which points to another locations where another item of data can be located. When data is required to be added or deleted to a list, it becomes a valuable function of a linked list that additions or deletions can be operated without having to move other items of data. The only parts which actually change are the pointers within the list. The end pointer is usual to be known as a free space pointer at at least one location, which will be where new data is added in the list. The deletion of an item of data will cause a change of pointer location, not of the actual data itself. The procedure for adding a new node. The process for this is shown in five simplied steps below: 1. Determine where in the list the node is to be inserted 2. Store data at the position indicated by free storage pointer 3. Alter free storage pointer to point to the next free location. 4. Alter the files on either side. Eg. 1-2-3 (with 2 being the new node, 1 is linked to 2 and 2 to 3 via changing the current 13 pointer locations. The same principal can be used for circular (ring) lists with the start and end pointer being attached to the same node. Tree Structures Data can not exactly fit into a list structure, and other structures (eg hierarchial data structure) are used. Such a data structure is useful for a related objects, for example a vehicle parts list with the car as a whole taking the primary hierarchial postion. At the bottom of the tree there is a child node which is said to have no children (most commonly called a leaf node or terminal node). Although this is easier to quickly locate data in this way, it is more difficult to add and delete nodes compared with that of linear lists. It is usual to use some form of stack, so that the route though the tree can be tracked to the previously visited nodes. Binary Trees These are a kind of the parent node is only allowed two terminal nodes. Binary tree structures are implemented using pointer systems in similar ways to the node pointers used with linked lists. Once the child node from the parent node is chosen, the further choices exist in a sub-tree because the root node is no longer entirely accessible. Hash tables A hash funtion is a set of rules when applied to a five digit key field creates a suitable address in the table. The has function is simmialr to a pointer that is used to point to a location where the necessary data is located. A generalised has function is used simmialry to the following example Address = Hash function (key field) Hash function = key field is squared, then taken right- hand digits and finally add 1. Using the hashing function for the following number: (12345) we get: Original Number|Number squared|Right-hand three digits|Right-hand three digits ADD 1 12345 152399025 025 26 One disadvantage of the hashing function is their ability to create the same address within the table for different key fields. This is known as a collision.

Wednesday, March 4, 2020

Arabica Coffee History and Facts

Arabica Coffee History and Facts The Arabica coffee bean is the Adam or Eve of all coffees, in that is likely the first type of coffee bean ever consumed. Arabica is by far the dominant bean used today, representing about 70 percent of global production. History of the Bean Its origins date back to about 1,000 BC in the highlands of the Kingdom of Kefa, which is present-day Ethiopia. In Kefa, the Oromo tribe ate the bean, crushed it and mixed it with fat to make spheres the size of ping-pong balls. The spheres were consumed for the same reason that coffee is consumed today, as a stimulant. The plant species Coffea Arabica got its name around the 7th century when the bean crossed the Red Sea from Ethiopia to present-day Yemen and lower Arabia, hence the term arabica. The first written record of coffee made from roasted coffee beans comes from Arab scholars, who wrote that it was useful in prolonging their working hours. The Arab innovation in Yemen of making a brew from roasted beans spread first among the  Egyptians  and  Turks, and later on, found its way around the world. Taste Arabica is considered the merlot of coffee, it has a mild taste, and to coffee drinkers, it can be described  to have a sweetness, that is light and airy, like the mountains it comes from. Well-known Italian coffee grower Ernesto Illy wrote in the June 2002 issue of Scientific American: Arabica is a medium-to low-wielding,  rather delicate  tree from five to six meters tall that  requires  a temperate climate and considerable growing care. Commercially grown coffee bushes are pruned to a height of 1.5 to 2 meters. Coffee made from arabica beans has an intense, intricate aroma that can be reminiscent of flowers, fruit, honey, chocolate, caramel or toasted bread. Its caffeine content never exceeds 1.5 percent by weight. Because of its superior quality and taste, arabica sells for a higher price than its hardy, rougher cousin​ Growing Preferences Arabica takes about seven years to mature fully. It grows best in higher altitudes but can be grown as low as sea level. The plant can tolerate low temperatures, but not frost.  Two to four years after planting, the arabica plant produces small, white, highly fragrant flowers. The sweet fragrance resembles the sweet smell of jasmine flowers. After pruning, berries begin to appear. The berries are dark green like the leaves until they begin to ripen, at first to yellow and then light red and finally darkening to a glossy, deep red. At this point, they are called â€Å"cherry† and are ready for picking. The prize of the berries are the beans inside, usually two per berry. Gourmet Coffee Gourmet coffees are almost exclusively high-quality mild varieties of arabica coffee, and among the best-known arabica coffee beans in the world. The gourmet growing regions include the Jamaican Blue Mountains, Colombian Supremo, Tarrazà º, Costa Rica, Guatemalan, Antigua and Ethiopian Sidamo. Typically, espresso is made from a blend of arabica and robusta beans. The robusta species of coffee of beans make up the 30 percent difference of global coffee bean production.