Jump to content

Static and dynamic data structures

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Ansumang (talk | contribs) at 12:38, 12 October 2011 (added Category:Data structures using HotCat). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Static and dynamic data structures are collection of data components that are constructed in a regular and characteristic way. There is a relationship between some kind of data item in data structure, which is manipulated with computer science technologies. The simplest data structure [1]is one dimensional array in which each element is stored with particular memory address, which is in form of number. Computer science has developed manipulatable & easily sortable data structures which are in large numbers.

Static data structure

In it,memory is allocated statically i.e. it is possible to change content but without increasing the memory space allocated to it. Static variables are created in the declaration of a program and exit that space till its conclusion. [2] So if memory requirement expands or shrinks at the time of executing the program, memory is insufficent for that data or wasted respectively.

Characterstics of static data structure

  • Fast access of elements.
  • Memory is allocated at the compile-time.
  • Static allocation are memory inefficent
e.g. array data type,records,etc
  • No re-usability of allocated memory.
  • Difficult to guess the exact size at the time of writing program
File:Linked list representation.jpg
Linked list representation

Dynamic data structure

In it,memory is allocated dynamically i.e. it is possible to add elements, delete existing elements as well as modifying it without caring about it's initial value. The allocation of memory during the running of a program and under the control of the program is said to be dynamic memory allocation. Dynamic memory is managed in 'C' language through a set of library functions.

Allocating a block memory in C.

ptr= ( cast- type) malloc(byte- size); the "malloc()" returns a pointer ( of cast type) to an area of memory with size. EX.x= (int*)malloc(100*size of(int));

A linked list is an example of dynamic data structure. It can grow or shrink at time of execution. The ADT known as a Linked List is the simplest example of a data structure providing the capability of dynamically adapting to accommodate changes in the quantity of information stored.

Characterstics of dynamic data structure

  • Slower access of elements.
  • Required memory is allocated at run time, so memory is not wasted here.
e.g. stack,ques,etc
  • Unwanted space can be reased at run time.
  • ALL linked structure are preferably implemented through dynamic data structure.
  • Re-usability of memory space. 0

See also

Template:Wikipedia-Books

Books

  • Title=Give Me back My Data structure|year=2010|author=A. Slowinska, T. Stancescu, and H. Bos.

References

  1. ^ A. Slowinska, T. Stancescu, and H. Bos. (2010). Give Me back My Data structure. Amsterdam. ISBN 0 340 74152 X.{{cite book}}: CS1 maint: location missing publisher (link) CS1 maint: multiple names: authors list (link)
  2. ^ "Ayoma Online".
  1. [1]