Professional Documents
Culture Documents
DM Project 3
DM Project 3
GROUP MEMBERS:
Ajay Chovatiya (202201203)
Darshan Gami (202201205)
Harsh Rathod (202201212)
INSTRUCTORS:
Prof.Manish Gupta
Prof.Manoj Raut
Prof.Prosenjit Kundu
1
INDEX
1. Introduction 3
2. Problem Statement 5
7. Conclusion 19
8. Bibliography 20
2
INTRODUCTION
One prominent example of the Divide and Conquer strategy can be found
in the work of Al-Khwarizmi, a Persian mathematician and philosopher
who lived during the 9th century. Al-Khwarizmi is known for his signifi-
cant contributions to mathematics, particularly in the field of algebra. He
wrote a book titled ”Kitab al-Jabr wa al-Muqabala,” which laid the foun-
dation for modern algebra and introduced systematic methods for solving
equations.paradigm.
3
DIVIDE AND CONQUER ALGORITHM
4
WHAT IS DIVIDE AND CONQURE ALGORITHM:
PROBLEM STATEMENT
Design an efficient algorithm that can handle a wide range of input point
distributions and provide a solution with optimal time complexity. The
algorithm should be able to handle edge cases such as collinear points, du-
plicate points, and degenerate cases where the convex hull is a line segment
or a single point.
5
Solution Of Convex HuLL Problem using Divide and
Conquer Algorithm :
Consider a set of points in a two-dimensional plane: (1, 2), (3, 5), (4, 3),
(2, 7), (6, 1), (5, 4),(3,1),(2,4). We’ll use the Divide and Conquer Convex
Hull algorithm to find the convex hull of these points.
Divide: We divide the set of points into two subsets along a horizontal
line. Let’s say we divide the points into (1, 2), (3, 1), (6,1) and (2, 7), (4,
3), (5, 4),(3,5),(2,4).
Conquer: We recursively compute the convex hull of each subset. For the
first subset, the convex hull is (1, 2), (3, 1), (6,1). For the second subset,
the convex hull is (2, 7),(5,4)).
6
Merge: To merge the convex hulls, we find the upper tangent and lower
tangent points, which are the points where the two convex hulls touch each
other. In this case, The merged convex hull becomes (1, 2), (6, 1), (2, 7),
(5, 4),(3,1).
Visually, the merged convex hull represents the smallest convex polygon
that encloses all the given points. In our example, the convex hull is a
7
pentagon connecting the outermost points (1, 2),(6, 1), (2, 7), (5, 4),(3,1).
The divide and conquer approach in computing the convex hull reduces
the time complexity to O(n log n), where n is the number of input points.
This algorithm efficiently solves the convex hull problem and is widely used
in practice.
Divide and conqure algorithms, which find the smallest convex polygon
that encloses a set of points, have several real-life applications in various
fields. Here are some examples:
8
3. Event Organization :Divide Conqure Algorithm can be Used to in
Event Organization.Big Events Like Olympic,World Cup,etc.. have many
participants and Events So first we can devide whole Event in small task
after we can use conqure method Because it is useful for making team for
each task. so We give task to all team and finally we combine/merge them
so our event is now organizable very easily and quickly.
9
5. Project Management: Divide and conquer algorithms can be utilized
in project management for task allocation, scheduling, and resource op-
timization. By dividing large projects into smaller subprojects or tasks,
project managers can assign responsibilities, set deadlines, and manage
resources more effectively.
10
MATHEMATICAL ASPECTS OF THESE
ALGORITHMS IN OUR PROJECT
Example:
Let’s consider organizing a music festival with multiple stages, perfor-
mances, and logistical arrangements.
1. Divide:
Divide the event planning process into smaller tasks and subtasks:
- Stage setup and equipment arrangement
- Artist booking and scheduling
- Ticketing and registration
- Security and crowd management
- Food and beverage arrangements
- Marketing and promotion
11
2. Conquer:
Allocate responsibility for each task or subtask to different teams
or individuals:
- Stage setup and equipment arrangement: Assign a team of tech-
nicians and stage managers.
- Artist booking and scheduling: Appoint a team or individual
responsible for contacting and managing artists’ schedules.
- Ticketing and registration: Assign a team to handle ticket sales
and registration processes.
- Security and crowd management: Hire a professional security
team or work with a security agency.
- Food and beverage arrangements: Coordinate with vendors and
caterers to provide food and beverage services.
- Marketing and promotion: Assign a team or individual to handle
advertising, social media campaigns, and promotion efforts.
3. Combine:
Bring together the contributions from each team or individual to
create a cohesive and successful event:
- Coordinate with the stage setup team to ensure the stages are
prepared and equipped for performances.
- Collaborate with the artist management team to finalize the
lineup and schedule performances.
- Work with the ticketing team to manage ticket sales and entry
to the event.
- Coordinate with the security team to ensure the safety of atten-
dees and manage crowd control.
- Collaborate with food and beverage vendors to provide refresh-
ments and dining options.
- Work with the marketing team to promote the event and attract
attendees.
By dividing the event planning process into smaller tasks and assigning
responsibility for each task, the event organizers can efficiently manage
various aspects of the music festival. The contributions from each team or
individual are combined to create a successful and well-organized event.
12
By using divide and conqure algorithm our task’s / code’s worst case
time complexity is O(nlogn).Brute force time complexity is O(n2 ) . This
algorithm is better than brute force that’s why we preferred to use this
algorithm.
13
int res = (b.second-a.second)*(c.first-b.first) -
(c.second-b.second)*(b.first-a.first);
if (res == 0)
return 0;
if (res > 0)
return 1;
return -1;
}
if (one != two)
return (one < two);
return (p.second * q.first < q.second * p.first);
}
int ia = 0, ib = 0;
for (int i = 1; i < n1; i++)
if (a[i].first > a[ia].first)
ia = i;
14
int inda = ia, indb = ib;
bool done = 0;
while (!done)
{
done = 1;
while (orientation(b[indb], a[inda], a[(inda+1)%n1]) >= 0)
inda = (inda + 1) % n1;
15
{
ind = (ind+1)%n1;
ret.push_back(a[ind]);
}
ind = lowerb;
ret.push_back(b[lowerb]);
while (ind != upperb)
{
ind = (ind+1)%n2;
ret.push_back(b[ind]);
}
return ret;
}
int a1 = y1 - y2;
int b1 = x2 - x1;
int c1 = x1 * y2 - y1 * x2;
int pos = 0, neg = 0;
for (int k = 0; k < a.size(); k++)
{
if (a1 * a[k].first + b1 * a[k].second + c1 <= 0)
neg++;
if (a1 * a[k].first + b1 * a[k].second + c1 >= 0)
pos++;
}
if (pos == a.size() || neg == a.size())
{
16
s.insert(a[i]);
s.insert(a[j]);
}
}
}
return ret;
}
17
return merger(left_hull, right_hull);
}
int main()
{
vector<pair<int, int>> a;
a.push_back(make_pair(1, 3));
a.push_back(make_pair(2, 7));
a.push_back(make_pair(3, 5));
a.push_back(make_pair(6, 1));
a.push_back(make_pair(4, 3));
a.push_back(make_pair(5, 4));
int n = a.size();
sort(a.begin(), a.end());
vector<pair<int, int>> ans = divide(a);
return 0;
}
CONCLUSION
This project was an exhilarating expedition for all of us. It served as a
compelling illustration of how intricate challenges can be adeptly tackled
through fundamental mathematical principles. Furthermore, we came to
the realization that the practical application of Discrete Mathematics ex-
tends well beyond the confines of academia, permeating various facets of
our daily lives and exerting influence on numerous aspects of our existence.
18
dress a diverse array of complex problems. By disassembling a sizable
problem into smaller, manageable subproblems, this algorithm harnesses
the power of parallel processing and minimizes computation time. While
certain limitations exist, it remains an adaptable tool for resolving a broad
spectrum of quandaries in fields such as computer science, mathematics,
and engineering.
BIBLIOGRAPHY
—REFERENCES—
https://www.geeksforgeeks.org/
convex-hull-using-graham-scan/
https://en.wikipedia.org/wiki/Divide-and-conquer_
algorithm
https://www.careerguide.com/career/wp-content/
uploads/2020/01/event-management-bg.jpg
19
https://images.shiksha.com/mediadata/images/
articles/1583747992phpzaxKKK.jpeg
https:
//upload.wikimedia.org/wikipedia/commons/thumb/5/
57/Tesla_auto_bots.jpg/330px-Tesla_auto_bots.jpg
https://shorturl.at/esyzG
https://shorturl.at/cfzB5
-: THANK YOU :-
20