-->
Search here and hit enter....

Designing Approach of Algorithms | Top Down v/s Bottom Up

Hello, Viewer! Tomorrow we have learned about ALGORITHMS and Today we will learn about the Designing Approach of Algorithms. So let's Start...



Designing Approach of Algorithms means HOW we write an algorithm or how to start writing algorithms. there are two ways we use to design algorithms.

1) Top-Down Approach

2) Bottom-Up Approach


Top-Down Algorithm

In this approach,, we have basic knowledge about the result mean we know about the problems and the result of how it gonna work. In this approach we just do -divide the BIG Problem into smaller problems or Modules and again divide the problem into sub-module until its easy to implement or code and then work on each sub-module to get the actual goal or desired output. {understand with example}

Example: - 

Suppose we have to build a "Shopping Mall". {here we know the final result of what we are going to build}. Instead of directly building a shopping mall we can divide this bigger work into smaller-smaller parts like firstly making a "KIDS SECTION", "BOUTIQUE", "FOOTWEAR" etc. and after creating these categories we just simply merge it together to build a "SHOPPING MALL". Here we go from Top{Final Result} to Down{basics modules} process.

top-down approach


Bottom-Up Approach

In this approach, we don't have much knowledge about the Final Result {how it look like or desired output}. In this, we directly start from the smaller-smaller part of code and each time gonna merge it together to make a final design. {understand with example}

Example:-

We 1st build "Jewellery Shop", "Restaurant", "Mobile Shop" etc and after building this we add these sections altogether to make a "SHOPPING MALL" / "COMPLEX".


bottom up approach

Whether Top-Down or Bottom-Up 

The main thing of choosing a Top-Down OR Bottom-Up approach is completely depending on the problems at hand.

While Top-Down approaches follow a stepwise process by breaking the algorithm into manageable modules. On the other hand, the Bottom-Up approach defines a module and groups together several modules to form a new higher module.

Top-Down is highly choosable because of ease in documenting the modules generation of test cases, implementation of code and debugging. Although the Bottom-Up approach allows information hiding as it 1st identifies what has to be encapsulated within a module.


top down approach


Top-Down v/s Bottom-Up


Top-Down Approach Bottom-Up Approach
In this approach, we move from top to bottom In this approach, we move to go from bottom to top
Ease in documenting, implementation of code, and debugging provide an abstract interface
This approach is used when we have a good idea of the final result but we have very less details about each section This approach is used when we have enough idea about each section/module of a program but less idea of the overall program.
This approaches mainly focus on "HOW THE TASK IS DONE" i.e. Procedure This approaches mainly focus on "HOW DATA SECURE"




That's all for today! I hope you like it! See You Soon...
FB COMMENTS ()