• Join over 1.2 million students every month
• Accelerate your learning by 29%
• Unlimited access from just £6.99 per month
Page
1. 1
1
2. 2
2
3. 3
3
4. 4
4

# 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

# Related AS and A Level Computer Science essays

1. ## Principles of Computer Networks

3 star(s)

When it receives the message then it will send back a status or a replay saying HTTP/2.1 300 OK and it will also send its own message with the status reply. SMTP SMTP protocol which stands for Simple Mail Transfer Protocol.

2. ## Smart Card System

Among these obstacles, the major headache that surrounding the team is the programming tool that the team have chosen. The JAVA programming language sound like a stranger to the team.

1. ## 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.

2. ## AQA Computing CPT3

petrol that has been dispensed throughout the day tempSt String Up to 255 legal characters '0.48' This will provide a temporary variable locations which holds the representation of the digits, this is store in form of string tempNo Number 0 - 99.99 94.32 This will provide a temporary variable location

1. ## Creating a computer system for Wooten Basset Rugby Club

* Monitor finances for each fixture. For each fixture a player has to pay a fee of �2. Other important points taken from the interview: * System must be as automated as possible as user wants system to save him time. * Simple user interface. Several of the coaches whom will use the system have very

2. ## ELECTRONIC DATA INTERCHANGE

Can you do EDI on your current system? If not, you will need to decide which hardware platform best suits the needs of your business. Software choice will center on whether to develop in-house or purchase third party coding. A decision will need to be made whether to build EDI

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

Customer Records Sheet/ Receipts Initial Problem Definition A slow customer service as a result of paper based filing systems for storing data. These cannot be accessed quickly with phone-based customers and may lead to frustration. Each customer has a single folder for their data and it is not ordered in

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