Custom Search

Saturday, November 5, 2011

Data structures

A data structure is a scheme of organizing related data items. Depending upon the problem to be tackled, data items ranges from elementary data types to data structures. Integers and characters are elementary data types and one-dimensional arrays used to implement matrices are data structures. Data structures play an important role in computer algorithms. Array and linked list are the most important elementary data structures. An array is a sequence of n items of the same data type and these are stored in computer memory. This can be accessed by specifying a value of the array’s index. Index is an integer. Any element of one particular array can be accessed in the same constant amount of time regardless of its location. This is the main difference between arrays and linked lists. Arrays are used to implement a variety of data structures like strings. String is a sequence of characters from an alphabet terminated by a special character. Binary strings or bit strings are those strings are `those strings which are comprised of zeroes and ones. A linked list is a sequence of zero or more elements called nodes. Each node contains some data and pointers. These pointers are acting as links to other nodes of linked list. In a singly linked list, each node except the last one contains a single pointer to the next element.

No comments: