0% found this document useful (0 votes)
343 views5 pages

Fundamental Algorithmic Strategies in DAA

There are several fundamental algorithmic strategies discussed in the document: 1. Brute force algorithms try every possible solution through brute computational force. 2. Recursive algorithms break problems into subproblems that call on themselves to solve the overall problem. 3. Divide and conquer algorithms divide problems into smaller subproblems, solve the subproblems independently, and then combine the results.

Uploaded by

mhghtgxdfhhjkjl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
343 views5 pages

Fundamental Algorithmic Strategies in DAA

There are several fundamental algorithmic strategies discussed in the document: 1. Brute force algorithms try every possible solution through brute computational force. 2. Recursive algorithms break problems into subproblems that call on themselves to solve the overall problem. 3. Divide and conquer algorithms divide problems into smaller subproblems, solve the subproblems independently, and then combine the results.

Uploaded by

mhghtgxdfhhjkjl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

DAA unit-2

FUNDAMENTAL ALGORITHMIC STRATEGIES:


Most important type of Algorithm :
Algorithm: 
An algorithm is a step-by-step procedure to solve a problem. A good algorithm should be optimized
in terms of time and space. Different types of problems require different types of algorithmic-
techniques to be solved in the most optimized manner. There are many types of algorithms but the
most important and the fundamental algorithms that you must know will be discussed in this article.
[Link] Force Algorithm: 
This is the most basic and simplest type of algorithm. A Brute Force Algorithm is the straightforward
approach to a problem i.e., the first approach that comes to our mind on seeing the problem. More
technically it is just like iterating every possibility available to solve that problem.
For Example: If there is a lock of 4-digit PIN. The digits to be chosen from 0-9 then the brute force
will be trying all possible combinations one by one like 0001, 0002, 0003, 0004, and so on until we
get the right PIN. In the worst case, it will take 10,000 tries to find the right combination.
[Link] Algorithm:
This type of algorithm is based on recursion. In recursion, a problem is solved by breaking it into
subproblems of the same type and calling own self again and again until the problem is solved with
the help of a base condition.
Some common problem that is solved using recursive algorithms are Factorial of a Number, Fibonacci
Series, Tower of Hanoi, DFS for Graph, etc.
[Link] and Conquer Algorithm:
In Divide and Conquer algorithms, the idea is to solve the problem in two sections, the first section
divides the problem into subproblems of the same type. The second section is to solve the smaller
problem independently and then add the combined result to produce the final answer to the problem.
Some common problem that is solved using Divide and Conquers Algorithms are Binary
Search, Merge Sort, Quick Sort, Strassen’s Matrix Multiplication, etc.
[Link] Programming Algorithms:
This type of algorithm is also known as the memoization technique because in this the idea is to store
the previously calculated result to avoid calculating it again and again. In Dynamic Programming,
divide the complex problem into smaller overlapping subproblems and storing the result for future
use.
The following problems can be solved using Dynamic Programming algorithm Knapsack
Problem, Weighted Job Scheduling, Floyd Warshall Algorithm, Dijkstra Shortest Path Algorithm, etc.
[Link] Algorithm:
In the Greedy Algorithm, the solution is built part by part. The decision to choose the next part is done
on the basis that it gives the immediate benefit. It never considers the choices that had taken
previously.
Some common problems that can be solved through the Greedy Algorithm are Prim’s
Algorithm, Kruskal’s Algorithm, Huffman Coding, etc.
[Link] Algorithm: 
In Backtracking Algorithm, the problem is solved in an incremental way i.e. it is an algorithmic-
technique for solving problems recursively by trying to build a solution incrementally, one piece at a
time, removing those solutions that fail to satisfy the constraints of the problem at any point of time.
[Link] AND BOUND:
Branch and bound algorithms are used to find the optimal solution for combinatory,
discrete, and general mathematical optimization problems. In general, given an NP-
Hard problem, a branch and bound algorithm explores the entire search space of possible
solutions and provides an optimal solution.
A branch and bound algorithm consist of stepwise enumeration of possible candidate
solutions by exploring the entire search space. With all the possible solutions, we first build a
rooted decision tree. The root node represents the entire search space:

Here, each child node is a partial solution and part of the solution set. Before constructing
the rooted decision tree, we set an upper and lower bound for a given problem based on the
optimal solution. At each level, we need to make a decision about which node to include in
the solution set. At each level, we explore the node with the best bound. In this way, we can
find the best and optimal solution fast.
Now it is crucial to find a good upper and lower bound in such cases. We can find an upper
bound by using any local optimization method or by picking any point in the search space.
On the other hand, we can obtain a lower bound from convex relaxation or duality.
In general, we want to partition the solution set into smaller subsets of solution. Then we
construct a rooted decision tree, and finally, we choose the best possible subset (node) at
each level to find the best possible solution set.
When Branch and Bound Is a Good Choice?
We already mentioned some problems where a branch and bound can be an efficient choice
over the other algorithms. In this section, we’ll list all such cases where a branch and bound
algorithm is a good choice.

If the given problem is a discrete optimization problem, a branch and bound is a good
choice. Discrete optimization is a subsection of optimization where the variables in the
problem should belong to the discrete set. Examples of such problems are 0-1 Integer
Programming or Network Flow problem.
Branch and bound work efficiently on the combinatory optimization problems. Given
an objective function for an optimization problem, combinatory optimization is a process to
find the maxima or minima for the objective function. The domain of the objective function
should be discrete and large. Boolean Satisfiability, Integer Linear Programming are
examples of the combinatory optimization problems.
Advantages:
In a branch and bound algorithm, we don’t explore all the nodes in the tree. That’s why the
time complexity of the branch and bound algorithm is less when compared with other
algorithms.
If the problem is not large and if we can do the branching in a reasonable amount of time, it
finds an optimal solution for a given problem.
The branch and bound algorithm find a minimal path to reach the optimal solution for a given
problem. It doesn’t repeat nodes while exploring the tree.
Disadvantages:
The branch and bound algorithm are time-consuming. Depending on the size of the
given problem, the number of nodes in the tree can be too large in the worst case.
Also, parallelization is extremely difficult in the branch and bound algorithm.
Bin Packing Explained
 The fundamental aim of bin packing is to pack a collection of objects into well defined
regions called bins, so that they do not overlap. In the real world, the critical issue is
to make efficient use of time and/or space. A bin for example, need not necessarily
be a container, but could represent a space in time or a surface area.
The One-Dimensional Bin Packing Problem:
 Mathematically, the one-dimensionalbin packing problem can be described as
follows:
Given a bin capacity C>0 and a list of objects {p1, p2,...., pn}, what is the smallest number of
bins needed to accommodate all of the objects? ( Each pi has size si, such that 0<=si<=C.
i.e. none of the objects too big to fit in a bin)
Four easily recognisable one-dimensional bin packing problems are detailed below:
 A material such as piping or cable is supplied in quantities of a standard length C.
The demands for pieces of the material are for varying lengths that do not exceed C.
The idea is to use the least number of standard lengths of the material in producing a
given set of required pieces. Hence minimising the wastage.
 Advertisments of arbitrary lengths, must be assigned to commersial break time slots
on television. Each break must last no longer than three minutes.
 Removal lorries with set weight limits are to be packed with furniture. The aim is to
use as few lorries as possible to pack all the items, without exceeding the maximum
weight in any lorry.
 A set of tasks with known, arbitrary execution times, need to be executed on some
identical processors by a given deadline. The problem is to schedule all of the tasks
onto the least number of machines so that the deadline is met.
In the last example, it is time that is the critical resource. It is a scheduling problem; the
processors are the bins, the deadline is the common bin capacity, and the individual
execution times of the tasks are the objects (pi) in the list.
The Two-Dimensional Bin Packing Problem:
 This problem is concerned with packing different sized objects (most commonly
rectangles) into fixed sized, two-dimensional bins, using as few of the bins as
possible. Applications of this type of problem are often found in stock cutting
examples, where quantities of material such as glass or metal, are produced in
standard sized, rectangular sheets. Demands for pieces of the material are for
rectangles of arbitrary sizes, no bigger than the sheet itself. The problem is to use the
minimum number of standard sized sheets in accommodating a given list of required
pieces.
 A variation on the two-dimensional bin packing problem is the strip packing problem
and this is the area that I shall be concentrating on most.

Heuristic :
The need for Heuristic Evaluation :
Heuristic Evaluation is the process of thorough evaluation/assessment where the experts in a
particular domain, used to measure the usability of the user interface. Usability can be defined as how
easily a specific user can use a particular design or say interface without facing any problem. In
general, we can say the Heuristic Evaluation is performed to detect the issues in the design of a
product. It also identifies the ways to resolve those issues present in design and meet the user
expectations.
Heuristic Evaluation is an in-depth usability test that is performed by the experts. As it is also well
known to everyone that better usability, higher the number of users will interact with the product.
Jakob Nielsen and Rolf Molich are web usability pioneers who published the article in 1990, which
contains a set of heuristics. A heuristic can be defined as the fast and practical way to approach a
problem and make effective decisions to solve those problems. Experts use the heuristics approach to
systematically evaluate the user experience (UX) design.
When to conduct Heuristic Evaluation :
There is no such rule when to perform the Heuristics Evaluation, but it can be performed at any stage
of the design process. Most of the time the heuristic evaluation is performed after the paper
prototyping and usability test. As Heuristics Evaluation helps to optimize the design of the user-
interface it becomes very important to be performed to evaluate the final design.
How to conduct Heuristic Evaluation :
Define the Scope of Evaluation – 
Mentioning the budget and deadline becomes very important at the time of evaluation. One should
also define the different parameters where they want to conduct the usability test.  
Know the End-User – 
As we know, different groups of people have different expectations from a product. So it becomes
very important to know the end-user and their interest.
Choose your Set of Heuristics – 
Without a proper heuristic, the Heuristics Evaluation will produce unreliable and useless results if all
the evaluators are not going to use the same guidelines.
Setting-up an Evaluation System and Identifying Issues –
Decide the different categories in which a problem should be categories like a critical issue, minor
issue, etc. Evaluators must follow the guidelines of system evaluation.
Analyze and Summarize the Results –
It becomes very necessary to analyze the issue present in the design of user interface and solve those
issues before the deadline.
Advantages :  
 Reveals many hidden usability problems.
 It helps to determine the overall user experience.
 Heuristics evaluation can be combined with usability testing.
 Better Heuristics Evaluation helps to engage more users.
 It is cheaper and faster than conducting full-blown usability testing.
Disadvantages :  
 Sometimes it is a bit hard for even experts to figure out some problems.
 It becomes hard to find experts to conduct the Heuristics Evaluation.
 We will need few expert evaluators, so that it will become easier for us to stick with
usability testing.
 Flaws in design will affect the engagement of users in the product.
 Heuristics testing depends on the expertise level of only a few experts.

Common questions

Powered by AI

Backtracking algorithms solve problems incrementally and are suitable for problems where decisions can be reversed, such as puzzle solving and pathfinding . While generally easier to implement, they explore more possible solutions without optimality guarantees. Branch and Bound, however, is more structured in searching via optimality bounds and pruning, making it more suitable for finding optimal solutions in large combinatorial and discrete optimization problems like the 0-1 Knapsack . Despite backtracking's ease, Branch and Bound leverages decision trees and bounds to potentially operate more efficiently by avoiding unnecessary paths, whereas backtracking tends to retry different combinations exhaustively .

The Branch and Bound algorithm explores the entire search space to find an optimal solution for NP-hard problems by systematically considering all candidates and using a decision tree to eliminate non-promising branches based on bounds . The algorithm evaluates upper and lower bounds through partial solutions and selective exploration, focusing only on branching paths that could potentially lead to an optimal solution. Thus, it reduces unnecessary work by pruning branches when a bound is less promising than the current best solution . By combining these bounds, Branch and Bound provides optimal solutions even in inherently difficult problem spaces like 0-1 Integer Programming .

Heuristic Evaluation is advantageous in identifying usability problems and improving the user experience efficiently . It is faster and more cost-effective than comprehensive usability testing and can be conducted at any stage of the design process . However, challenges include finding expert evaluators and the limitations due to reliance on expert skill level. Moreover, it may not identify all usability issues, especially those that manifest in real user scenarios . Overall, while affordable and quick, it requires expertise and careful analysis to yield useful improvements.

Dynamic programming is used in optimization by storing previously computed results to avoid redundant calculations, especially beneficial for solving problems with overlapping subproblems and optimal substructure, like the Knapsack and Shortest Path problems . Greedy algorithms, on the other hand, build up a solution piece by piece by choosing the option with the most immediate benefit without consideration for future consequences. While both aim to optimize, greedy algorithms might not always yield an optimal solution for all inputs as they can overlook global optimal solutions . The primary difference is that dynamic programming considers future possibilities by remembering past decisions, whereas greedy algorithms solely focus on immediate advantages.

Recursion, by its nature, can lead to inefficiencies due to repeated calculations of the same subproblems, especially in complex algorithms requiring repeated resolution of identical states . This results in increased time complexity and stack overflow risk in deep recursive calls. Dynamic programming addresses these issues by storing results of overlapping subproblems in a table (memoization), thus preventing recomputation and significantly optimizing the process . This is crucial in problems like Fibonacci number calculation, where dynamic programming reduces the exponential time complexity to linear through efficient subproblem storage.

The Bin Packing problem has practical applications in various domains; examples include packing cables or piping to minimize material wastage, assigning television advertisements to time slots, packing furniture into removal lorries while maximizing space, and scheduling processors with task execution times . Each of these applications utilizes bin packing solutions to optimize resource usage, whether it's space, time, or materials, by finding the minimum number of bins needed to fit all items under a given constraint . This is vital in logistics, telecom, and computer scheduling where efficiency and cost reduction are paramount.

Recursive algorithms solve a problem by breaking it into subproblems of the same type, and then using their solutions to solve the original problem, a common example being the calculation of factorial numbers . Divide and Conquer, however, involves dividing a problem into independent subproblems, solving each independently, and then combining the solutions, examples include Quick Sort and Merge Sort . The key difference lies in the independence of subproblems: Recursive algorithms may involve overlapping subproblems while Divide and Conquer works on dividing the problems into non-overlapping subproblems.

Heuristic Evaluations, while efficient, face key challenges such as limited scope due to dependency on a limited number of evaluators who must possess significant expertise . This approach relies heavily on predefined evaluation criteria, which may not cover all user perspectives or real-life user scenarios, possibly missing unpredictable user interactions. Conversely, usability testing involves real users and diverse feedback, though it's more resource-intensive. Therefore, a Heuristic Evaluation might not uncover all usability issues that could arise from actual user behavior in varied contexts .

A Brute Force Algorithm is a straightforward method to solve problems by trying every possible option until finding the correct solution. This approach can be effective in scenarios where the number of possibilities is limited or where simple exhaustive search is feasible, such as attempting all combinations in a small search space. However, due to its inefficiency with time complexity in larger datasets, it is generally impractical for problems with large potential combinations .

'Divide and Conquer' can optimize machine learning model training by decomposing tasks into smaller, manageable computational units. Similar to applying the concept in sorting algorithms, large datasets can be split into smaller chunks to train models on subsets of the data, reducing memory usage and parallelizing processing . Techniques like MapReduce employ Divide and Conquer principles by processing and aggregating data across distributed systems. In gradient boosting, models are independently trained on separate data blocks which are later combined to form the final predictive model, thus increasing training efficiency and scalability.

You might also like