• Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month

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.

Extracts from this document...

Introduction

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. Introduction 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. ...read more.

Middle

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 computer's memory requires mapping of each element of the array to the corresponding locations that will score the array. ...read more.

Conclusion

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. ?? ?? ?? ?? 1 2.05 ...read more.

The above preview is unformatted text

This student written piece of work is one of many that can be found in our AS and A Level Computer Science section.

Found what you're looking for?

  • Start learning 29% faster today
  • 150,000+ documents available
  • Just £6.99 a month

Not the one? Search for your essay title...
  • Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month

See related essaysSee related essays

Related AS and A Level Computer Science essays

  1. Peer reviewed

    Principles of Computer Networks

    3 star(s)

    The ring goes around and station wanting to transmit data will take control of it and send it to the destination and when the transmission is completed than the token ring is destroyed and new one is created. IEEE 802.11 Set of standards which put into operation WLAN communication in the 2.4, 3.6 and 5 GHz spectrum band.

  2. Betting Shop computer investigation

    has overall responsibility for ensuring that the law and these principles are adhered to. Ruth Sutton's investigation into a local betting shop. Firstly I was called into the office and was allocated a new case, which involved investigating a betting shop that may have been involved in some kind of fraud or computer misuse.

  1. AQA Computing CPT3

    and the dispensed petrol clock (variable - fuelClock). The button will also change the current pump status of "Pump Is In Use" to "Pump Stopped, Replace Nozzle". The Replace Nozzle button will change the current status of the pump from "Pump Stopped, Replace Nozzle" to "Awaiting Payment", this will allow

  2. Smart Card System

    In order to provide the security benefits of access lists, we should at a minimum configure access lists on border routers. Routers are situated at the edges of the network. This provides a basic buffer from the outside network, or from a less controlled area of our own network into a more sensitive area of our network.

  1. Creating a computer system for Wooten Basset Rugby Club

    * System will be run from head coach's lap top computer and therefore not need any network capabilities. * Head coach has copies of Microsoft Access already stored on his computer.

  2. ELECTRONIC DATA INTERCHANGE

    into existing computer application, or to adopt the simpler course of action and manually transfer data from the existing manual system to the EDI. g) Training and Education Training and education is the most important aspect of implementing EDI. It is most important that everyone involved in the new technology arrangement should understand it.

  1. Definition-nature of the problem solved - Car Mechanic business

    It would be difficult to know when to visit to be able to see the other side of the business. Also, some customers may be opposed to there payments not being confidential. It may be possibly to get a small glimpse at the workplace following my interview.

  2. Designing a computer system for the Enfield hotel.

    , for how many persons. , have you stayed here before. , tells them the price. Then if the customer is happy with the price, the following happens: * Secretary then takes down the customers, Name Contact number Credit card number This is written down in either book A1/ A2 depending on the month.

  • Over 160,000 pieces
    of student written work
  • Annotated by
    experienced teachers
  • Ideas and feedback to
    improve your own work