Data Structure and C

 Data Structure and C










A C programmer can think of the C language as defining a new machine with  its own capabilities , data types and types and operations . the user can state a problem solution in terms of the more useful C constructers. Thus , problem can be solved more easily because a larger set of tools is available in C.


The study of data structure therefore involves two complementary goals. The first goal is to identify  and develop useful mathematical entities and operations and to determine what classes of problems  can be solved by using these entities and operations  The second goal is to determine representation for those abstract entities and to implement the abstract operations on these concrete  representation . The first of these goals views a high-level data types as a tool that can be used to solve other problems and the second views the implementation of such a data type as a problem to be solved using already existing
data types . In determining representations for abstract entities, we must be careful to specify what facilities are  available for constructing such  representation . 











It is important to recognise the limitation of a particular implementation. Often it will be possible to present several implementation of the same data type, each with its own strengths and weaknesses. One particular implementation may be better than another for a specific application and the programmer must be aware of the possible trade-offs that might be involved.











One important consideration in any implementation  is its efficiency. In fect ,the reason that the high - level data structures are not built into C is the significant overhead that they would entail. There are languages of significantly higher level  than C that have many of them are inefficient and are therefore not in widespread use .













Efficiency is usually measured by two factors : time and space. If a particular application is  heavily dependent on manipulating high - level data structures, the speed at which those manipulations can be performed will be the major determinant of the speed of the entire application. Similarly, if a program uses a large number of such structures . An implementation that uses an inordinate amount of space to  represent the data structure will be impractical. Unfortunately, there is usually a trade - off  between these two efficiencies, so that an implementation that is fast uses more storage than one that is slow a case involves a careful evaluation of the trade - offs among the various possibilities. 















         Algorithm :












An algorithm is a finite and step - by - step list of well - defined instructions for solving a particular problem. 

     An algorithm is thus a sequence of computational steps that transform the input into the output. We can also view an algorithm as a toll for solving a well specified computational problem. An algorithm is said to be correct if for every input instance, it halts with the correct output. We can say that a correct a algorithm solves the given computational problem.











Properties of Algorithm : 

An algorithm must have the following properties -

1. Input :

                        An must receive some input data supplied externally.

2.Output :

                        An algorithm must produce at least one output as the result.

3.Finiteness : 

                                No matter what is the input, the algorithm must terminate after a finite number of steps. For example, a procedure which goes on performing a series of steps infinitely is not an algorithm.

4. Definiteness : 

                             The steps to be performed in the algorithm must be clear and unambiguous.

5. Effectiveness : 

                       One must be able to perform the steps in the algorithm without applying any intelligence. For example, the step - select three numbers which form a Pythogorian triplet - is not effective. 














Types of Algorithm : 

All algorithm are of two types-











1. Iterative (Repetitive) Algorithm : 

It is typically use loops and conditional statements. 


2. Recursive Algorithms : 

It is use a "divide and conquer" strategy. As per this strategy the recursive algorithm breaks down a large problem into small pieces and then applies the algorithm to each of these small pieces. This often makes the recursive algorithm small, straightforward and simple to understand.





 Thank You...





Comments

Popular posts from this blog

Array Declaration

Description of Various Data Structures