- A parallel search algorithm finds two elements in a sorted array that bracket a query element in logarithmic time using p processors (paragraph 1).
- A parallel merging algorithm uses the parallel search to rank and merge two sorted arrays in optimal O(log log n) time and O(n log log n) work (paragraph 2).
- An efficient sorting algorithm uses the optimal parallel merging algorithm in a merge sort approach to sort n elements in O(n log n) work and O(log n log log n) time (paragraph 3).
These slides are about parallel sorting algorithms. In which four types of sorting algorithms are discussed with the comparison between their sequential and parallel ways. The four algorithms which are included are: Bubble sort, merge sort, Bitonic sort and Shear sort.
In computer science a sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order. Efficient sorting is important for optimizing the use of other algorithms (such as search and merge algorithms) which require input data to be in sorted lists; it is also often useful for canonicalizing data and for producing human-readable output. More formally, the output must satisfy two conditions:
The output is in nondecreasing order (each element is no smaller than the previous element according to the desired total order);
The output is a permutation (reordering) of the input.
Further, the data is often taken to be in an array, which allows random access, rather than a list, which only allows sequential access, though often algorithms can be applied with suitable modification to either type of data.
These slides are about parallel sorting algorithms. In which four types of sorting algorithms are discussed with the comparison between their sequential and parallel ways. The four algorithms which are included are: Bubble sort, merge sort, Bitonic sort and Shear sort.
In computer science a sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order. Efficient sorting is important for optimizing the use of other algorithms (such as search and merge algorithms) which require input data to be in sorted lists; it is also often useful for canonicalizing data and for producing human-readable output. More formally, the output must satisfy two conditions:
The output is in nondecreasing order (each element is no smaller than the previous element according to the desired total order);
The output is a permutation (reordering) of the input.
Further, the data is often taken to be in an array, which allows random access, rather than a list, which only allows sequential access, though often algorithms can be applied with suitable modification to either type of data.
Introduction to sorting algorithms with a broad overview (in Ruby pseudocode) of each sort's main features, beginning with Insertion Sort. *gifs do not show properly
Introduction to sorting algorithms with a broad overview (in Ruby pseudocode) of each sort's main features, beginning with Insertion Sort. *gifs do not show properly
Artificial Bee Colony (ABC) is a swarm
optimization technique. This algorithm generally used to solve
nonlinear and complex problems. ABC is one of the simplest
and up to date population based probabilistic strategy for
global optimization. Analogous to other population based
algorithms, ABC also has some drawbacks computationally
pricey due to its sluggish temperament of search procedure.
The solution search equation of ABC is notably motivated by a
haphazard quantity which facilitates in exploration at the cost
of exploitation of the search space. Due to the large step size in
the solution search equation of ABC there are chances of
skipping the factual solution are higher. For that reason, this
paper introduces a new search strategy in order to balance the
diversity and convergence capability of the ABC. Both
employed bee phase and onlooker bee phase are improved
with help of a local search strategy stimulated by memetic
algorithm. This paper also proposes a new strategy for fitness
calculation and probability calculation. The proposed
algorithm is named as Improved Memetic Search in ABC
(IMeABC). It is tested over 13 impartial benchmark functions
of different complexities and two real word problems are also
considered to prove proposed algorithms superiority over
original ABC algorithm and its recent variants
Spider Monkey optimization (SMO) algorithm is newest addition in class of swarm intelligence. SMO is a population based stochastic meta-heuristic. It is motivated by intelligent foraging behaviour of fission fusion structured social creatures. SMO is a very good option for complex optimization problems. This paper proposed a modified strategy in order to enhance performance of original SMO. This paper introduces a position update strategy in SMO and modifies both local leader and global leader phase. The proposed strategy is named as Modified Position Update in Spider Monkey Optimization (MPU-SMO) algorithm. The proposed algorithm tested over benchmark problems and results show that it gives better results for considered unbiased problems.
Artificial Bee Colony (ABC) algorithm is a Nature Inspired Algorithm (NIA) which based in intelligent food foraging behaviour of honey bee swarm. ABC outperformed over other NIAs and other local search heuristics when tested for benchmark functions as well as factual world problems but occasionally it shows premature convergence and stagnation due to lack of balance between exploration and exploitation. This paper establishes a local search mechanism that enhances exploration capability of ABC and avoids the dilemma of stagnation. With help of recently introduces local search strategy it tries to balance intensification and diversification of search space. The anticipated algorithm named as Enhanced local search in ABC (EnABC) and tested over eleven benchmark functions. Results are evidence for its dominance over other competitive algorithms.
Artificial Bee Colony (ABC) optimization
algorithm is one of the recent population based probabilistic
approach developed for global optimization. ABC is simple
and has been showed significant improvement over other
Nature Inspired Algorithms (NIAs) when tested over some
standard benchmark functions and for some complex real
world optimization problems. Memetic Algorithms also
become one of the key methodologies to solve the very large
and complex real-world optimization problems. The solution
search equation of Memetic ABC is based on Golden Section
Search and an arbitrary value which tries to balance
exploration and exploitation of search space. But still there
are some chances to skip the exact solution due to its step
size. In order to balance between diversification and
intensification capability of the Memetic ABC, it is
randomized the step size in Memetic ABC. The proposed
algorithm is named as Randomized Memetic ABC (RMABC).
In RMABC, new solutions are generated nearby the best so
far solution and it helps to increase the exploitation capability
of Memetic ABC. The experiments on some test problems of
different complexities and one well known engineering
optimization application show that the proposed algorithm
outperforms over Memetic ABC (MeABC) and some other
variant of ABC algorithm(like Gbest guided ABC
(GABC),Hooke Jeeves ABC (HJABC), Best-So-Far ABC
(BSFABC) and Modified ABC (MABC) in case of almost all
the problems.
Differential Evolution (DE) is a renowned optimization stratagem that can easily solve nonlinear and comprehensive problems. DE is a well known and uncomplicated population based probabilistic approach for comprehensive optimization. It has apparently outperformed a number of Evolutionary Algorithms and further search heuristics in the vein of Particle Swarm Optimization at what time of testing over both yardstick and actual world problems. Nevertheless, DE, like other probabilistic optimization algorithms, from time to time exhibits precipitate convergence and stagnates at suboptimal position. In order to stay away from stagnation behavior while maintaining an excellent convergence speed, an innovative search strategy is introduced, named memetic search in DE. In the planned strategy, positions update equation customized as per a memetic search stratagem. In this strategy a better solution participates more times in the position modernize procedure. The position update equation is inspired from the memetic search in artificial bee colony algorithm. The proposed strategy is named as Memetic Search in Differential Evolution (MSDE). To prove efficiency and efficacy of MSDE, it is tested over 8 benchmark optimization problems and three real world optimization problems. A comparative analysis has also been carried out among proposed MSDE and original DE. Results show that the anticipated algorithm go one better than the basic DE and its recent deviations in a good number of the experiments.
Artificial Bee Colony (ABC) is a distinguished optimization strategy that can resolve nonlinear and multifaceted problems. It is comparatively a straightforward and modern population based probabilistic approach for comprehensive optimization. In the vein of the other population based algorithms, ABC is moreover computationally classy due to its slow nature of search procedure. The solution exploration equation of ABC is extensively influenced by a arbitrary quantity which helps in exploration at the cost of exploitation of the better search space. In the solution exploration equation of ABC due to the outsized step size the chance of skipping the factual solution is high. Therefore, here this paper improve onlooker bee phase with help of a local search strategy inspired by memetic algorithm to balance the diversity and convergence capability of the ABC. The proposed algorithm is named as Improved Onlooker Bee Phase in ABC (IoABC). It is tested over 12 well known un-biased test problems of diverse complexities and two engineering optimization problems; results show that the anticipated algorithm go one better than the basic ABC and its recent deviations in a good number of the experiments.
Artificial bee colony (ABC) algorithm is a well known and one of the latest swarm intelligence based techniques. This method is a population based meta-heuristic algorithm used for numerical optimization. It is based on the intelligent behavior of honey bees. Artificial Bee Colony algorithm is one of the most popular techniques that are used in optimization problems. Artificial Bee Colony algorithm has some major advantages over other heuristic methods. To utilize its good feature a number of researchers combined ABC algorithm with other methods, and generate some new hybrid methods. This paper provides comparative analysis of hybrid differential Artificial Bee Colony algorithm with hybrid ABC – SPSO, Genetic algorithm and Independent rough set approach based on some parameters like technique, dimension, methodology etc. KEYWORDS
Artificial bee colony (ABC) algorithm has proved its importance in solving a number of problems including engineering optimization problems. ABC algorithm is one of the most popular and youngest member of the family of population based nature inspired meta-heuristic swarm intelligence method. ABC has been proved its superiority over some other Nature Inspired Algorithms (NIA) when applied for both benchmark functions and real world problems. The performance of search process of ABC depends on a random value which tries to balance exploration and exploitation phase. In order to increase the performance it is required to balance the exploration of search space and exploitation of optimal solution of the ABC. This paper outlines a new hybrid of ABC algorithm with Genetic Algorithm. The proposed method integrates crossover operation from Genetic Algorithm (GA) with original ABC algorithm. The proposed method is named as Crossover based ABC (CbABC). The CbABC strengthens the exploitation phase of ABC as crossover enhances exploration of search space. The CbABC tested over four standard benchmark functions and a popular continuous optimization problem.
Multiplication of two 3 d sparse matrices using 1d arrays and linked listsDr Sandeep Kumar Poonia
A basic algorithm of 3D sparse matrix multiplication (BASMM) is presented using one dimensional (1D) arrays which is used further for multiplying two 3D sparse matrices using Linked Lists. In this algorithm, a general concept is derived in which we enter non- zeros elements in 1st and 2nd sparse matrices (3D) but store that values in 1D arrays and linked lists so that zeros could be removed or ignored to store in memory. The positions of that non-zero value are also stored in memory like row and column position. In this way space complexity is decreased. There are two ways to store the sparse matrix in memory. First is row major order and another is column major order. But, in this algorithm, row major order is used. Now multiplying those two matrices with the help of BASMM algorithm, time complexity also decreased. For the implementation of this, simple c programming and concepts of data structures are used which are very easy to understand for everyone.
Smart Huffman Compression is a software appliance designed to compress a file in a better way. By functioning as an JSP, it provides high level abstraction of java Servlet. For example, Smart Huffman Compression encodes the digital information using fewer bits, reduces the size of file without loss of data in a single, easy-to-manage software appliance form factor. It also provides us the decompression facility also. Smart Huffman Compression provides our organization with effective solutions to reduce the file size or lossless compression of data. It also expedites security of data using the encoding functionality. It is necessary to analyze the relationship between different methods and put them into a framework to better understand and better exploit the possibilities that compression provides us image compression, data compression, audio compression, video compression etc.
Artificial Bee Colony (ABC) algorithm is a Nature
Inspired Algorithm (NIA) which based on intelligent food
foraging behaviour of honey bee swarm. This paper introduces
a local search strategy that enhances exploration competence
of ABC and avoids the problem of stagnation. The proposed
strategy introduces two new local search phases in original
ABC. One just after onlooker bee phase and one after scout
bee phase. The newly introduced phases are inspired by
modified Golden Section Search (GSS) strategy. The proposed
strategy named as new local search strategy in ABC
(NLSSABC). The proposed NLSSABC algorithm applied over
thirteen standard benchmark functions in order to prove its
efficiency.
Program slicing technique is used for decomposition of a program by analyzing that particular program data
and control flow. The main application of program slicing includes various software engineering activities such as
program debugging, understanding, program maintenance, and testing and complexity measurement. When a slicing
technique gathers information about the data and control flow of the program taking an actual and specific execution
(or set of executions) of it, then it is said to be dynamic slicing, otherwise it is said to be static slicing. Generally,
dynamic slices are smaller than static because the statements of the program that affect by the slicing criterion for a
particular execution are contained by dynamic slicing. This paper reports a new approach of program slicing that is a
mixed approach of static and dynamic slice (S-D slicing) using Object Oriented Concepts in C++ Language that will
reduce the complexity of the program and simplify the program for various software engineering applications like
program debubbing.
Articial bee Colony algorithm (ABC) is a population based
heuristic search technique used for optimization problems. ABC
is a very eective optimization technique for continuous opti-
mization problem. Crossover operators have a better exploration
property so crossover operators are added to the ABC. This pa-
per presents ABC with dierent types of real coded crossover op-
erator and its application to Travelling Salesman Problem (TSP).
Each crossover operator is applied to two randomly selected par-
ents from current swarm. Two o-springs generated from crossover
and worst parent is replaced by best ospring, other parent remains
same. ABC with real coded crossover operator applied to travelling
salesman problem. The experimental result shows that our proposed
algorithm performs better than the ABC without crossover in terms
of eciency and accuracy.
Performance evaluation of diff routing protocols in wsn using difft network p...Dr Sandeep Kumar Poonia
In the recent past, wireless sensor networks have been introduced to use in many applications. To design the networks, the factors needed to be considered are the coverage area, mobility, power consumption, communication capabilities etc. The challenging goal of our project is to create a simulator to support the wireless sensor network simulation. The network simulator (NS-2) which supports both wire and wireless networks is implemented to be used with the wireless sensor network.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
The field of Information retrieval (IR) is currently undergoing a transformative shift, at least partly due to the emerging applications of generative AI to information access. In this talk, we will deliberate on the sociotechnical implications of generative AI for information access. We will argue that there is both a critical necessity and an exciting opportunity for the IR community to re-center our research agendas on societal needs while dismantling the artificial separation between the work on fairness, accountability, transparency, and ethics in IR and the rest of IR research. Instead of adopting a reactionary strategy of trying to mitigate potential social harms from emerging technologies, the community should aim to proactively set the research agenda for the kinds of systems we should build inspired by diverse explicitly stated sociotechnical imaginaries. The sociotechnical imaginaries that underpin the design and development of information access technologies needs to be explicitly articulated, and we need to develop theories of change in context of these diverse perspectives. Our guiding future imaginaries must be informed by other academic fields, such as democratic theory and critical theory, and should be co-developed with social science scholars, legal scholars, civil rights and social justice activists, and artists, among others.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Let's dive deeper into the world of ODC! Ricardo Alves (OutSystems) will join us to tell all about the new Data Fabric. After that, Sezen de Bruijn (OutSystems) will get into the details on how to best design a sturdy architecture within ODC.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Lecture23
1. An overview of lecture
• A parallel search algorithm
• A parallel merging algorithm
• A parallel sorting algorithm
2. A parallel search algorithm
• We discuss an algorithm for parallel
searching in a sorted array.
• n is the number of elements in a sorted
array S and we use p, p < n processors for
searching.
• The complexity of the parallel searching
algorithm is: .
log( 1)
log( 1)
n
O
p
3. A parallel search algorithm
Input:
(i) A sorted array S = x1,x2,…,xn with n
elements.
(ii) A query element y.
Output: Two elements xi, xi +1 in S such that
xi y xi +1.
4. A parallel search algorithm
• The algorithm consists of a series of iterations to
reduce the size of the array where the element y
is located.
• In each iteration, we divide the current array in
p + 1 equal parts and locate y in one of the parts.
• This is continued until the size of the array where
y is located is reduced to p.
• We then do a direct comparison to find two
elements xi, xi +1 such that xi y xi +1.
6. A parallel search algorithm
• For each of the p + 1 parts of the array, a
processor checks whether y < xl, where xl is the
last element of the part.
• If y < xl, the subarray to the right of xl can be
rejected. If y > xl, the subarray to the left of xl can
be rejected.
• In each iteration we identify only one subarray for
further search.
7. A parallel search algorithm
• When the size of the remaining array is the same
as the number of processors, we do the following.
• We allocate one processor for each element.
• The processor assigned to element xi checks
whether xi y xi +1.
• Hence it takes O(1) time to locate y once the size
of the array has been reduced to p.
8. Complexity
• We need to analyze what is the complexity of
reducing the size of the array to p.
• At the first iteration, we are reducing the size of
the array from n to n/p.
• Suppose, the size reduces to p after k iterations.
• Hence, , which implies n = pk +1.
• . We need the CREW PRAM model.
log
( )
log
n
k O
p
k
n
p
p
9. Merging
• We use the parallel search algorithm to design an
optimal O(loglog n) time merging algorithm.
• rank(x : X) is the number of elements of X that are
x.
• Ranking a sequence Y = (y1, y2, …, yn) in X is the
same as:
• Computing the integer array : (r1, r2, …, rm) where
ri = rank(yi, X).
10. Merging
• If rank(ai, A) = r1 and rank(ai, B) = r2
• rank(ai, A +B) = r1 + r2.
• Hence, ai should go to the entry number r1 + r2 in
the merged array.
11. Ranking a short sequence in a
sorted sequence
• X is a sorted sequence with n elements.
• Y is an arbitrary sorted sequence of size m such
that m = O(ns), where s is a constant and 0 < s < 1.
• If we use processors,
• Then we can rank each element of Y in X
in time.log
( ) (1)
log
n
O O
p
1
( )sn
p O n
m
12. A fast merging algorithm
• We now discuss a fast algorithm for merging two
sorted arrays A and B with n and m elements
each.
• Fast merging is an essential component in any
sorting algorithm based on divide-and-conquer.
• We will first design an O(loglog m) time and
O((m + n) loglog m) work algorithm.
• Then we will improve the work to O(m + n) which
is optimal.
13. A fast merging algorithm
Input: Two sorted sequences A and B of lengths
n and m respectively.
Output: rank(B : A) and rank(A : B).
•We use a strategy similar to the merging
algorithm we discussed earlier.
•We divide the array B into parts, each part
with elements.
•We start with ranking the last element from
each part of B into A.
m
m
14. Ranking a sample of elements
• We start with a sample of elements from B.
• We choose every –th element from B.
• These elements can be ranked in A in O(1)
time through binary search in parallel using m
processors.
m
m
m
16. Ranking elements in O(1) time
m m
m
m m m
m elements
m elements A
B
For every element in B, we allocate processors.m
In one step, we identify the block of elements in
A where an element of B will be ranked.
m
We find the rank in another step.
17. Ranking a sample of elements
• B is partitioned into blocks, each of size .
• After the ranking of the elements from B in A.
• A is also partitioned into blocks.
• We can now merge the blocks in A and B
pairwise recursively.
m m
m
m
18. Independent subproblems
• Consider the first element of B2 and the first element of B3,
the elements r and s.
• Now, r is ranked at u and s is ranked at v.
• Consider an element p such that r < p < s. p must be ranked
in between u and v.
• Hence, all the elements in B2 must be ranked in A2 and vice
verse.
19. Ranking a sample of elements
• Suppose at the current level of recursion, the size
of the two subproblems B’ and A’ are m’ and n’.
• If m’ > n’, then we divide B’ into parts and apply
the algorithm recursively.
• If n’ > m’, we divide A’ into parts and apply the
algorithm recursively.
'm
'n
22. Recursion
• The recursion between all pairs of blocks can
be solved in parallel.
• The recursion stops when the size of the
subproblems is small and we can merge the
very small blocks through a sequential
algorithm in O(1) time.
• At the end of the algorithm, we know rank(B :
A) and rank(A : B). Hence, we can move the
elements to another array in sorted order.
23. Complexity
• The recursion satisfies the recurrences
either :
or,
• The processor requirement is O(m + n).
• The total work done is O(m + n) loglog m.
( ) ( ) (1)T n T n O
( ) ( ) (1)T m T m O
24. An optimal merging algorithm
• The make the algorithm optimal, we need to reduce
the work to O(m + n).
• We use a different sampling strategy and use the fast
algorithm that we have designed. For simplicity, we
assume that each array has n elements.
• We divide the arrays A and B into blocks of size
loglog n.
• We choose the last element from each block as our
sample and form two arrays A’ and B’.
• Hence each of A’ and B’ has elements.loglog
n
n
25. Taking the samples
• Now we compute rank(A’ : B’) and rank(B’ : A’)
using the algorithm we have designed.
• This takes O(loglog n) time and
or O(n) work.
( loglog )
loglog
n
O n
n
26. Ranking the elements
• We now compute rank(A’ : B) in the following
ways.
• Suppose the elements in A’ are:
p1, p2,…, pn / loglog n.
27. Ranking the elements
• Consider pi A’. If rank(pi : B’) is the first element in
block Bk,
• Then rank(pi,B) must be some element in block Bk.
• We do a binary search using one processor to
locate rank(pi,B).
28. Ranking the elements
• We allocate one processor for pi. The processor
does a binary search in Bk.
• Since there are O(loglog n) elements in Bk, this
search takes O(logloglog n) time.
• The search for all the elements in A’ can be done
in parallel and requires processors.
• We can compute rank(B’ : A) in a similar way.
( )
loglog
n
O
n
29. Recursion again
• Consider Ai, a loglog n block in A.
• We know rank(p : B) and rank(q : B) for the two
boundary elements p and q of Ai.
• Now we can call our algorithm recursively with Ai and
all the elements in B in between rank(p : B) and
rank(q : B) .
30. Recursion again
• The problem is, there may be too many elements in
between rank(p : B) and rank(q : B).
• But then there are too many loglog n blocks in
between rank(p : B) and rank(q : B) .
31. Recursion again
• The boundaries of all these blocks must be ranked in Ai.
• Hence we get pairs of blocks, one loglog n block from B
and a smaller block from Ai.
32. Solving the subproblems
• Now each of the two blocks participating in a
subproblem has size at most loglog n.
• And there are such pairs.
• We assign one processor to each pair. This
processor merges the elements in the pair
sequentially in O(loglog n) time.
• All the mergings can be done in parallel since we
have processors.
( )
loglog
n
O
n
loglog
n
n
33. Complexity
• Computing rank(A’ : B’) and rank(B’ : A’) take
O(loglog n) time and O(n) work.
• Computing rank(A’ : B) and rank(B’ : A) take
O(loglog n) time and O(n) work.
• The final merging also takes the same time and
work.
• Hence, we can merge two sorted arrays of length
n each in O(n) work and O(loglog n) time on the
CREW PRAM.
34. An efficient sorting algorithm
• We can use this merging algorithm to design an
efficient sorting algorithm.
• Recall the sequential merge sort algorithm.
• Given an unsorted array, we go on dividing the
array into two parts recursively until there is one
element in each leaf.
• We then merge the sorted arrays pairwise up the
tree.
• At the end we get the sorted array at the root.
35. An efficient sorting algorithm
• We can use the optimal merging algorithm to
merge the sorted arrays at each level.
• There are n elements in each level of this binary
tree distributed among several arrays depending
upon the level.
• Hence we need O(loglog n) time and O(n) work
for all the pairwise mergings at each level.
• The binary tree has a depth of O(log n) .
• Hence we can sort n elements in total work
O(n log n) and time O(log n loglog n)
36. Better sorting algorithms?
• This sorting algorithm is work-optimal
since the sequential lower bound for
sorting is (n log n).
• However, it is not time optimal.
• Cole’s pipelined merge sort algorithm is
an optimal O(log n) time and O(n log n)
work sorting algorithm on the EREW
PRAM.