Types of Data Structure - Frontecho-Mobile Laptop

Latest gadgets,Smartphone,Laptop

Breaking

My Blog List

Post Top Ad

Responsive Ads Here

Tuesday, 10 September 2019

Types of Data Structure

Types of Data structures:
                                          1.Static  >> These are data structures whose size is fixed at compile time and does not grow or shrink at run time. An example of a static data structure is an array. Suppose you declare an array of size 50, but store only 5 elements in it. Therefore, the memory space allocated for the remaining 45 elements will be wasted. Similarly,if you have declare an array of size 50, but later, if you want to store 20 more elements, you will not be able to store these additional elements because of the fixed size of an array
                                         2.Dynamic  >>These are data structures whose size is not fixed at compile time and that can grow and shrink at run time to make efficient use of memory. An example of a dynamic data structure will be a list of items for which memory is not allocated in advance. As and when items are added to the list, memory is allocated for those elements. Similarly, when items are removed from the list. memory allocated to those elements is deallocated. Such a list is called a linked list.
Techniques for Designing Algorithms: Although there is no systematic method for designing an algorithm, there are some well known techniques that have proved to be quite useful in designing algorithms. The Following two techniques are commonly used for designing algorithms:

  • Divide and conquer approach: The divide and conquer approach is an algorithm design technique that involves breaking down a problem recursively into sub problems until the sub problems become so small and trivial that they can be easily solved. The Solutions to the sub problems are then combined to give a solution to the original problem.Divide and conquer is a powerful approach for solving conceptually difficult problems. It simply requires you to find a way of breaking the problem into sub problems. solving the trivial cases, and combining the solutions to the sub problems to solve the original problem. Divide and conquer often provides a natural way to design efficient algorithms
  •  Greedy Approach: To greedy approach is an algorithm design technique that selects the best possible option at a given time. Algorithms based on the greedy approach are used for solving optimization problems where you need to maximize profits or minimize costs under a given set of conditions. Some examples of optimization problems are:

           i.Finding the shortest distance from an originating city to a set of destination cities. given the                distances between the pairs of cities.
           ii.the minimum number of currency notes required for an amount. where an arbitrary number                of notes for each denomination is available.
           iii.Selecting items with a maximum value from a given set of items, where the total weights of              the selected items cannot exceed a given value.
.


SUBSCRIBE MY YOUTUBE CHANNEL 

https://www.youtube.com/channel/UC5ENpny5rvbLRKCNg88SmZQ

No comments:

Post a Comment

Post Bottom Ad

Responsive Ads Here

Pages