Engineering in Kenya

Introduction to Data Structures

Posted by on Jan 15, 2018 in Physics | 0 comments


Data Structures involves the study of three things,

  1. Logical and mathematical description of the structure
  2. Implementation of the structure on a computer
  3. Quantity analysis of the structure which includes determining the amount of memory to store the structure, the time required to process the structure.

Data may be organized in many different ways; the logical or mathematical model of a particular organization and this is what is called data structure. The choice of a data model depends on two considerations. It must be rich enough in structure to mirror the actual relationship of data in the real world and it should be simple enough that one can effectively process the data when necessary. There are different type of data structures the arrays, linked list and the trees.Engineering in Kenya has more information.

 Introduction to Data StructuresType of Data Structures

1

John Brown
2 Sandra Guid
3 Tom Jones
4 Junes Kelly
5 Mary Reeds
6 Alan Smith

The simplest type of Data Structures is linear or one dimension array. Linear array consist a list of finite number (n) of similar data elements referenced respectively by a set of n consecutive numbers 1, 2, 3… n. The elements in an array are denoted by either using a subscript, for example, a1, a2, a3 … an or using bracket notation A [1], A [2], A [3] … A[n] or parenthesis notation A (1), A (2), A (3) … A (n) which are frequently used when the array name consist of more than one letter or when the array name appear in an algorithm. Unlike the linear array also one dimension array, which is it’s referenced by one subscript; the two dimension array is a collection of similar data element where each element is referenced by 2 subscripts. Such an array is called matrix, multi-dimensional array are defined analogously.

Department store 1 2 3
1 1434 213 977
2 545 344 1333
3 877 787 555

 

paydot 468x60 Introduction to Data Structures

 

 

(a)One dimension data structure array

(b)  A 2-dimension array

The other type of data structure which is commonly used is the linked lists. In linked list data structure the data elements can have different data pointers which can be the same or different. For example in a supermarket or in a bank the several customers are severed by different cashier or tellers respectively.

 

Customer Sales person
1 Adams Jones
2 Brown Ray
3 Clark Smith
4 Drew Ray
5 Evans Smith
6 Farmer Ray
7 Hill Jones
8 Geller Jones

An illustration of linked list data structure

Data frequently contain hierarchal relationship between various elements. The type of Data Structures which reflects this relationship is called rooted tree graph or simply a tree. Although in file system the file can be maintained by means of one or more arrays, records where one indicates both the group item and the elementary item can best be described by means of tree structure.

 

ID number                 first name

Name                         middle name

Last name

An example of tree data structure containing personal record data item.

Other Type of Data Structures

Other than arrays, linked list and trees data structure there is the stack. It is called a last in first out data structure. Items are removed from a stack in the reverse order from the way they were inserted that is it can be accessed at only one end (the top).

The other type of Data Structures is the queues. Also called first in first out system is a linear list in which deletion can take place only at one end of the list, the front of the list, and insertion can take place only at the other end of the list “rear” of the list. The structure operates in the same way as a queue of people waiting to enter a bus.

paydot 468x60 Introduction to Data Structures

Then there is the graph type of data structure. Data sometimes contain a relationship between pairs of element which are not necessary hierarchichal in nature. For example when an airplane flies to different cities in different countries it forms a graph.

Operations in Data Structures

The data appearing in Data Structures is processed by means of certain operation. The most frequently used operation includes, traversing. This involves accessing each record exactly once so that certain items in the record may be processed. This accessing and processing is sometimes called visiting the record.

The other operation involved in data structures is searching. This refers to finding the location of the record with a given key value or finding the location of all the record that satisfy the formal condition. Then there is inserting, adding a new record to the structure and deleting, removing a record from the structure. Sometime 2 or more kind of the operation may be used in a given situation, for example, to delete some key which may mean to first search the location of the record.

The following two operations are used in special occasion, that is sorting, which refers to arranging the record in some logical order. For example one can arrange a list of names in alphabetical order of some name key. Then there is the merging, combining the record in two different sorted files into a single sorted file. As above stated is the introduction to Data Structures