Data Structure Tutorial

Programming Approach

Flow Chart

Define Data Structure

DS Problem Solving


DS Data Types

DS Arrays

DS Stack

DS Queue

Number System

Spare matrix



Application of Stack

DS Linked List

DS Functions

DS Tree

DS Graph


Exercise Searching


Hash Table

DS Questions

Programming Approach

Programming Paradigm

The systematic and organized principle of writing a program is called as programming paradigm. It contains Procedural programming approach, Structural programming approach and Modular programming approach.

Procedural Programming Approach

In Procedural Programming, the problem is viewed in a sequence manner. It follows the concept of top-down approach. In procedural programming, we divide a problem into sub-problems recursively and then we write a procedure for each sub-problem. Procedures communicate with each other by parameters. In this approach, data is declared locally or globally. Pascal and C support this programming approach. For example, if you want to implement a stack, you divide the problem into smaller problems like how to push value in a stack, how to pop a value and how to find whether stack is full or empty. Then you write functions for Push, Pop, stack empty and stack full and call these functions using its parameters to implement a stack in a program. The stack size is declared in main program using a data structure (may be an array).

Advantages of Procedural Programming

  1. Easy to trace the bugs.
  2. Easy to traversal the program.

Disadvantages of Procedural Programming

  1. In large program it is very difficult to identify what data is used by which function.
  2. It does not allow reusability of code.

Structural Approach

Structural Approach refers to the process in which we break the overall job into separate pieces of modules. This approach is necessary to reduce the complexity of the program. One type of structural approach is Modular approach.

Advantages of Structural Approach:

  1. Modification or enhancement in programs becomes easier.
  2. Reduce debugging time.
  3. Allows several programmers to code simultaneously.

Modular Approach

In this approach, the program is divided into modules. Each module can contain procedures, functions, macros which are related to each other. and the data on which the act. Modular programming is the other name for Data hiding principle. For example, the complete set of operations of a stack including the data structure and functions may reside in a module.

C enables modular programming by providing provision for including files and separate compilation facilities. The context of module is supported by the class concept of C++.

Advantages of Modular Approach:

  1. Tracing of error is easier.
  2. Modules can be kept separately in a library and used anywhere in the program without re-writing them.
  3. A module can use other modules.
  4. It saves development time as we can reuse the code again and again.

Bottom-up Approach

Bottom up approach starts from the bottom level of operation and then a higher level until the stage is reached.

Advantages of Bottom-up Approach:

  1. It can handle the increasing complexity of program that are reliable and maintainable.
  2. It enables programmers to write complex programs easily.
  3. It is useful when designing the complex systems like operating system, networking software system etc.