Disclaimer: This essay is provided as an example of work produced by students studying towards a computer science degree, it is not illustrative of the work produced by our in-house experts. Click here for sample essays written by our professional writers.

Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of UKEssays.com.

Data Structures Role In Programming Languages Computer Science Essay

Paper Type: Free Essay Subject: Computer Science
Wordcount: 1834 words Published: 1st Jan 2015

Reference this

Data Structure is logical and mathematical model to store data.So there are basic benefits of data structures: The memory space is properly used.It helps in data protection and management. It is used to organize data in such a way that the insertion deletion,searhing i.e manipulation of data is done with minimal complexity , and that gives a efficiet performance of our computing. By using data structures data can be easily, and efficiently exchanged; it allows portability, comprehensibility, and adaptability of information.

Data structures are used in most programming allowing efficient management of large amounts of data.Data structures are the organizing element in software design, for some programming languages, and design methods. Data structures are based on a computer’s ability to store, and retrieve data from anywhere in memory; record, and array structures are based on using arithmetic operations to compute the address of the data. The storing of addresses within the structure is called linked data structures. Specific program languages offer built in support for specific data structures, (i.e. one dimensional arrays are used in C programming, and hash tables are used in Pearl). An array is a type of data structure.

An array is a data structure consisting of a number of variables, having the same data type. A single variable name is given to an array to associate with the variables. Arrays are used by programmers as a means of organizing many data items into a single data structure. Elements of the array are written, and recognized by using subscript, which is parenthesis after the array name. The use of arrays simplifies the writing of a program by allowing the grouping of similar data, rather than writing each item in the program code, saving time, and money.

An example of an array would be days of the week:

Initialize data table

day_table(1) = ‘Sunday’

day_table(2) = ‘Monday’

day_table(3) = ‘Tuesday’

day_table(4) = ‘Wednesday’

day_table(5) = ‘Thursday’

day_table(6) = ‘Friday’

day_table(7) = ‘Saturday’

End

All high level languages share a set of intercepted framework of data structure that composes the languages. These common data structures are strings, arrays, I/O, Stacks, Queues, Linked Lists, Trees, Graphs, Hash tables, and Vectors.

Most programming languages feature some sort of library mechanism that allows data structure implementations to be reused by different programs. Modern languages usually come with standard libraries that implement the most common data structures. Examples are the C++ Standard Template Library, the Java Collections Framework, and Microsoft’s .NET Framework.

Get Help With Your Essay

If you need assistance with writing your essay, our professional essay writing service is here to help!
Find out more about our Essay Writing Service

Data Structures in C Language :

A data item refers to a single unit of values. For example, a student’s information may be divided into four items/properties GRNO, name, class, and semester. But the GRNO would be treated as unique/ item. Data are also organized into more complex types of structures. There are two types of data structure are available :

Linear 2. Non-Linear.

Linear Structures: In this type of data structure we perform insert, delete, search,update operations sequentially or in an order (like Ascending/Descending). for example you have a list having 5 elements containing A,B,C,D,E,F values if u want to find that on which location E is store in this list, you must compare E with A,B,C,D and finally with E along this you must perform an increment to counter. After that you will find the actual location of your required/search item with the help of counter in this example the value of counter=4.

Examples of Linear Data Structures are as follows: * Array * Linked List * Queue * Stack 1. Non-Linear: In this type of data structure we perform Traversing, insert, delete, search, update operation randomly. # Examples of Non-Linear Data Structures are as follows: * Tree * Graphs.

Data Structure operations: The following four operations play a major role in this text.

1. Traversing: 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.)

2. Searching: Finding the location of the record with a given key value, or finding the locations of all records, which satisfy one or more conditions.

3. Inserting: adding a new record to the structure.

4. Deleting: Removing a record from the structure.

5. Sorting: Arranging the records in some logical order .

Some Data Structures and their use in programming Languages:

STACK:

A stack is a last in, first out (LIFO) abstract data type and data structure. A stack can have any abstract data type as an element, but is characterized by only two fundamental operations: push and pop. The push operation adds to the top of the list, hiding any items already on the stack, or initializing the stack if it is empty. The pop operation removes an item from the top of the list, and returns this value to the caller. A pop either reveals previously concealed items, or results in an empty list.

A stack-oriented programming language is one that relies on a stack machine model for passing parameters. Several programming languages fit this description, notably Forth, RPL, PostScript, and also many Assembly languages (but on a much lower level).

Some languages, like LISP and Python, do not call for stack implementations, since push and pop functions are available for any list. All Forth-like languages (such as Adobe PostScript) are also designed around language-defined stacks that are directly visible to and manipulated by the programmer.

C++’s Standard Template Library provides a “stack” templated class which is restricted to only push/pop operations. Java’s library contains a Stack class that is a specialization of Vector—this could be considered a design flaw, since the inherited get() method from Vector ignores the LIFO constraint of the Stack.

ARRAYS:

An array can be defined as the finite ordered set of homogeneous elements.Finite means that yhere are specific number of elements in an array, ordered means that elements are arranged in a sequence so that the first,second,third…nth element.

In pure functional programs it is common to represent arrays by association lists. Association lists have the disadvantage that the access time varies linearly both with the size of the array (counted in number of entries) and with the size of the index (counted in cons nodes).

QUEUE:

A queue is a particular kind of collection in which the entities in the collection are kept in order.It is based on First-In-First-Out (FIFO)principle. In a FIFO data structure, the first element added to the queue will be the first one to be removed. A queue is an example of a linear data structure.

LINKED LIST:

It is a method of organizing stored data in a computer memory or on a storage medium based on the logical order of the data and not the physical order. All stored data records are assigned a physical address in memory that the computer uses to locate the information. A linked list arranges the data by logic rather than by physical address.

Memory Management:

One of the most important functions of a programming language is to provide facilities for managing memory and the objects that are stored in memory. C provides three distinct ways to allocate memory for objects:

Static memory allocation: space for the object is provided in the binary at compile-time; these objects have an extent (or lifetime) as long as the binary which contains them is loaded into memory

Automatic memory allocation: temporary objects can be stored on the stack, and this space is automatically freed and reusable after the block in which they are declared is exited

Dynamic memory allocation: blocks of memory of arbitrary size can be requested at run-time using library functions such as malloc from a region of memory called the heap; these blocks persist until subsequently freed for reuse by calling the library function free

These three approaches are appropriate in different situations and have various tradeoffs. For example, static memory allocation has no allocation overhead, automatic allocation may involve a small amount of overhead, and dynamic memory allocation can potentially have a great deal of overhead for both allocation and deallocation. On the other hand, stack space is typically much more limited and transient than either static memory or heap space, and dynamic memory allocation allows allocation of objects whose size is known only at run-time. Most C programs make extensive use of all three.

Where possible, automatic or static allocation is usually preferred because the storage is managed by the compiler, freeing the programmer of the potentially error-prone chore of manually allocating and releasing storage. However, many data structures can grow in size at runtime, and since static allocations (and automatic allocations in C89 and C90) must have a fixed size at compile-time, there are many situations in which dynamic allocation must be used. Prior to the C99 standard, variable-sized arrays were a common example of this (see malloc for an example of dynamically allocated arrays).

Automatically and dynamically allocated objects are only initialized if an initial value is explicitly specified; otherwise they initially have indeterminate values (typically, whatever bit pattern happens to be present in the storage, which might not even represent a valid value for that type). If the program attempts to access an uninitialized value, the results are undefined. Many modern compilers try to detect and warn about this problem, but both false positives and false negatives occur.

Another issue is that heap memory allocation has to be manually synchronized with its actual usage in any program in order for it to be reused as much as possible. For example, if the only pointer to a heap memory allocation goes out of scope or has its value overwritten before free() has been called, then that memory cannot be recovered for later reuse and is essentially lost to the program, a phenomenon known as a memory leak. Conversely, it is possible to release memory too soon and continue to access it; however, since the allocation system can re-allocate or itself use the freed memory, unpredictable behavior is likely to occur. Typically, the symptoms will appear in a portion of the program far removed from the actual error, making it difficult to track down the problem. Such issues are ameliorated in languages with automatic garbage collection.

 

Cite This Work

To export a reference to this article please select a referencing stye below:

Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.

Related Services

View all

DMCA / Removal Request

If you are the original writer of this essay and no longer wish to have your work published on UKEssays.com then please:

Related Services

Our academic writing and marking services can help you!

Prices from

£124

Approximate costs for:

  • Undergraduate 2:2
  • 1000 words
  • 7 day delivery

Order an Essay

Related Lectures

Study for free with our range of university lecture notes!

Academic Knowledge Logo

Freelance Writing Jobs

Looking for a flexible role?
Do you have a 2:1 degree or higher?

Apply Today!