Question
Algorithm Mergesort(L,n): //L is a list of n>=0 numbers. if n>=2 then { m:=[n/2]; L1:= List containing first m element of L; L2:= List containing
Algorithm Mergesort(L,n):
//L is a list of n>=0 numbers.
if n>=2
then {
m:=[n/2];
L1:= List containing first m element of L;
L2:= List containing the last n-m elements of L;
L1:= Mergesort(L1,m);
L2:= Mergesort(L2, n+m);
L:=Merge(l1, l2);
}
return L.
Algorithm Merge( L1, L2):
//L1 and L2 are two sorted lists
L:= EmptyList;
while L1!= emptyset and L2 != emptyset
do{
x:= first element of L1;
y:= First element of L2;
{
if x
append x to L;
else remove y from L2;
append y to L;
}
}
if L1 is non empty then append L1 to L;
if L2 is non empty then append L2 to L;
Return L;
Question 9: Let n 1 be an integer and cus der a set S consisting of n points in R. Each point p of S is given by its z- and -cooedinates p, and p., rpeetively. We esume that no two polnts of S have the same -coordinate and Bo two points of S have the same y-coondinate A polut p of S is called merimal in S of p Le. thene is no point in S that is to the narth-east The figure below shows an example, in which the points are maximal and the x-points are not maximal. Ohserve that, in general, there is more than oue maximal element in S. Question 9: Let n 1 be an integer and cus der a set S consisting of n points in R. Each point p of S is given by its z- and -cooedinates p, and p., rpeetively. We esume that no two polnts of S have the same -coordinate and Bo two points of S have the same y-coondinate A polut p of S is called merimal in S of p Le. thene is no point in S that is to the narth-east The figure below shows an example, in which the points are maximal and the x-points are not maximal. Ohserve that, in general, there is more than oue maximal element in S
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started