Data Structures Role In Programming Languages Computer Science Essay

Published:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

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.

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.

Writing Services

Essay Writing
Service

Find out how the very best essay writing service can help you accomplish more and achieve higher marks today.

Assignment Writing Service

From complicated assignments to tricky tasks, our experts can tackle virtually any question thrown at them.

Dissertation Writing Service

A dissertation (also known as a thesis or research project) is probably the most important piece of work for any student! From full dissertations to individual chapters, we’re on hand to support you.

Coursework Writing Service

Our expert qualified writers can help you get your coursework right first time, every time.

Dissertation Proposal Service

The first step to completing a dissertation is to create a proposal that talks about what you wish to do. Our experts can design suitable methodologies - perfect to help you get started with a dissertation.

Report Writing
Service

Reports for any audience. Perfectly structured, professionally written, and tailored to suit your exact requirements.

Essay Skeleton Answer Service

If you’re just looking for some help to get started on an essay, our outline service provides you with a perfect essay plan.

Marking & Proofreading Service

Not sure if your work is hitting the mark? Struggling to get feedback from your lecturer? Our premium marking service was created just for you - get the feedback you deserve now.

Exam Revision
Service

Exams can be one of the most stressful experiences you’ll ever have! Revision is key, and we’re here to help. With custom created revision notes and exam answers, you’ll never feel underprepared again.