×

Close

- Data Structure using C - DS
- Note
- Computer Science Engineering
- B.Tech
**10 Views**- Uploaded 2 months ago

Data Structures are the programmatic way of storing data so that data can be used efficiently. Almost every enterprise application uses various types of data structures in one or the other way. Data Structure=Related Data + Allowed operation on them A data structure can be broadly classified into (i) Primitive data structure (ii) Non-primitive data structure (i) Primitive data structure Page 1 of 47

The data structures, typically those data structure that are directly operated upon by machine level instructions i.e. the fundamental data types such as int, float, double in case of ‘c’ are known as primitive data structures. (ii) Non-primitive data structure The data structures, which are not primitive are called non-primitive data structures. There are two types of non-primitive data structures. 1. Linear Data Structures:A list, which shows the relationship of adjacency between elements, is said to be linear data structure. The most, simplest linear data structure is a 1-D array, but because of its deficiency, list is frequently used for different kinds of data. 2. Non-linear data structure:A list, which doesn’t show the relationship of adjacency between elements, is said to be non-linear data structure. 1. Linear Data Structure Example: Arrays, Linked Lists, Stacks, Queues Page 2 of 47

2. Non linear Data Structure Example: Trees, Graphs Data Structure Operations 1. Traversing: Accessing each record exactly once so that certain items in the record may be processed. 2. Searching: Finding the location of the record with a given key value. 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. 6. Merging: Combing the records in two different sorted files into a single sorted file. Abstract Data Types Abstract Data type (ADT) is a type (or class) for objects whose behavior is defined by a set of value and a set of operations. The definition of ADT only mentions what operations are to be performed but not how these operations will be implemented. It does not specify how data will be organized in memory and what algorithms will be used for implementing the operations. It is called “abstract” because it gives an implementation independent view. Page 3 of 47

The process of providing only the essentials and hiding the details is known as abstraction. Three ADTs namely List ADT, Stack ADT, Queue ADT. Algorithm Definition: Algorithm is a step-by-step procedure, which defines a set of instructions to be executed in a certain order to get the desired output. Algorithms are generally created independent of underlying languages, i.e. an algorithm can be implemented in more than one programming language. From the data structure point of view, following are some important categories of algorithms − • • • • • Search − Algorithm to search an item in a data structure. Sort − Algorithm to sort items in a certain order. Insert − Algorithm to insert item in a data structure. Update − Algorithm to update an existing item in a data structure. Delete − Algorithm to delete an existing item from a data structure. Characteristics of an Algorithm Not all procedures can be called an algorithm. An algorithm should have the following characteristics − Page 4 of 47

## Leave your Comments