Don’t stop when you’re tired. STOP when you are DONE.
--Your friends at LectureNotes

Note for Data Structure using C - DS By SARMI SASIREKHA

  • Data Structure using C - DS
  • Note
  • 2 Topics
  • 45 Offline Downloads
  • Uploaded 3 months ago
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-1

Introduction to data structures IIIIII a[O] a[l] a[2] a[3] a[4] 3 memory representation 1.2 Figure 1.2 Storage Representation Of Data THE NEED FOR DATA STRUCTURES One of the tools that beginers often take for granted is the high-level level language in which they write their programs. Since most of us first learn to program in a language like C. we do not appreciate its branching and looping structures and built built-in data structures until we are later introduced ntroduced to language that do not have these features. In the first semester(C programming). we decided to use an array of structure to store our data. But what is an array? What is a structure? C. as well as many other hig hig-level level programming langauges. provides vides arrays and structure as built built-in in data structures. As a C programming. you can use these tools without concern about their implementation. much as a car driver can use a car without knowing about automobile technology. However, there are many interest interesting ing and useful ways of structuring data that are not provided in general-purpose purpose programming languages. The programmer who wants to use these structures must build them. In this book, we will look in detail four useful data structures: stacks, queues, list listss and binary trees. We will decribe each of these structures and design algorithms to manipulate them. We will build them using the tools that are available in the C language. Finally, we will examine applications where each is appropriate. First,however, we will develop a definition of data structure and an approach that we can use to examine data structures. By way of example, we will apply our definition and approach to familiar C data structures: the one dimensional array, the two dimensional array, and the structure. The two important goals of data structures are first to identify the representation of abstract entities and then to identify the operations. which can be performed with them. The operations help us to determine the class of problems, whi which can be solved with these entities. 4 Introduction to data structures The choice of data model depends on two considerations. First. it must be rich enough in structure to show the actual relationships of data in real world. On the other hand, the structure should be simple enough so that one can efficiently process the data when necessary. Data structure is nothing but arrangement of dat dataa and their relationship and the allowed operations. One can use simple data structure to build complex data structures.

Text from page-2

Data structures are fundamental to computer programming in any language. As progranuners work on algorithm development and problem analysis. they make crucial decisions about data structures. A data structure is a representation of the data in the program. The proper construction of a program is influenced by the choice of data structure. which is used. A data structure is a systematic way of organizing and accessing data, and an algorithm is a step- by-step procedure for perfonIling some task ina tillite amount of time. These concepts are central in computing. 1.3 GOALS OF DATA STRUCTURES The goals of data structures can be designed to answer certain questions such as 1. Does the data structure do what it is supposed to do? ,,2. Does the representation work according to the requirement specification , of the task? ~ 3. Is there a proper description of the representation des;cribing how to use .it and how it works? I The above questions when answered create the- fundamental goals that are used in designing descriptions of data structures. some of them are 1. Correctness i 2. Efficiency ., , ., 3. Robustness ,; 4. Adaptability 5. Reusability By correctness. we mean that a data structure is designed. to work correctly .for all possible inputs that one might encounter. For example. a data structure that is supposed to store a collection of numbers in order should never allow for elements i to be stored out of order. The precise meaning of correctness. will always depend I on the specific problem the data structure is intended to solve. but correctness should be a primary goal. Useful data structure and their operations also need to be efficient. That is, they should be fast and not use more of the computer's resources. such as memory space. than required. In a real-time situation, the speed of a data structure ~ operation can make the difference between success and failure, a difference that can often be quite important. , --'" ~ "

Lecture Notes