SlideShare ist ein Scribd-Unternehmen logo
1 von 10
Downloaden Sie, um offline zu lesen
Parallel quicksort
Sylwia Dzikiewicz
Marta Leniewska
Mikołaj Olszewski
Marcin Woch
Michał Żelazowski
Sequential quicksort
 Quicksort

(Array, start, end)

If (start < end)
middle = partition (Array, start, end)
quicksort(Array, start, middle)
quicksort(Array, middle+1, end)
Sequential quicksort
 Partition

(Array, start, end)

X = Array [start]
I = start - 1
J = end + 1
while TRUE
repeat J = J –1 until Array [ J ] <= X
repeat I = I +1 until Array [ I ] >=X
if I < J swap (Array [ I ], Array [ J ] )
else return J
Sequential quicksort – complexity
analysis
 Pessimistic
–

O (n2)

 Average
–

complexity

complexity

O (n log n)
Parallel quicksort
P a r a lle l q u ic k s o rt
Q s o rt
Q s o rt
Q s o rt

Q s o rt

Q s o rt

Q s o rt

Q s o rt

Q s o rt

Q s o rt

Q s o rt

Q s o rt
Parallel quicksort


How a single processor makes QuickSort (Array, start,
end)
–
–
–
–
–

J = Partition (Array, start, end)
Start a new thread on another processor : QuickSort(Array,
start, J)
Start a new thread on another processor : QuickSort(Array,
J+1, end)
Wait for both threads to complete
Notice your parent that your task is finished
Parallel quicksort
 OR
–
–
–
–
–

:

J = Partition (Array, start, end)
Start a new thread on another processor :
QuickSort(Array, start, J)
Execute QuickSort(Array, J+1, end)
Wait for the thread to complete
Notice your parent that your task is finished
Parallel quicksort
 In

case no processor can take thread, the
thread is put into a queue for later processing.
 After a processor has done its task, it checks
whether the queue contains any waiting
threads. If so, it removes the first task from the
queue and processes it.
Parallel quicksort
 Methods
–
–
–

of choosing the split key

First element
Average of : first, last and medium element
Median (the median of a sample is expected to be
the median of the whole array)
Parallel quicksort
A

new thread is created only if the length of the
array to sort is no less than MIN_ARRAY_SIZE
constant
 If the length of the array to sort is less than
MIN_QUICKSORT_SIZE, the array is sorted
using a simple algorithm (eg. Insertionsort or
Selectionsort), which require no new threads.
 MIN_QUICKSORT_SIZE <=
MIN_ARRAY_SIZE

Weitere ähnliche Inhalte

Was ist angesagt?

introduction to graph theory
introduction to graph theoryintroduction to graph theory
introduction to graph theoryChuckie Balbuena
 
Longest Common Subsequence
Longest Common SubsequenceLongest Common Subsequence
Longest Common SubsequenceSyeda
 
Fuzzy logic - Approximate reasoning
Fuzzy logic - Approximate reasoningFuzzy logic - Approximate reasoning
Fuzzy logic - Approximate reasoningDr. C.V. Suresh Babu
 
Overlapping clusters for distributed computation
Overlapping clusters for distributed computationOverlapping clusters for distributed computation
Overlapping clusters for distributed computationDavid Gleich
 
Islam and-science
Islam and-scienceIslam and-science
Islam and-scienceAsif Jokhio
 
Ai lecture 11(unit03)
Ai lecture  11(unit03)Ai lecture  11(unit03)
Ai lecture 11(unit03)vikas dhakane
 
computer-organization-and-architecture-9780070083332-0070083339_compress.pdf
computer-organization-and-architecture-9780070083332-0070083339_compress.pdfcomputer-organization-and-architecture-9780070083332-0070083339_compress.pdf
computer-organization-and-architecture-9780070083332-0070083339_compress.pdfSumitSamanta16
 
Introduction to Overleaf Workshop
Introduction to Overleaf WorkshopIntroduction to Overleaf Workshop
Introduction to Overleaf WorkshopOlga Scrivner
 
Collision prevention on computer architecture
Collision prevention on computer architectureCollision prevention on computer architecture
Collision prevention on computer architectureSarvesh Verma
 
CLOSEST PAIR (Final)
CLOSEST PAIR (Final)CLOSEST PAIR (Final)
CLOSEST PAIR (Final)Aruneel Das
 
Longest Common Subsequence (LCS) Algorithm
Longest Common Subsequence (LCS) AlgorithmLongest Common Subsequence (LCS) Algorithm
Longest Common Subsequence (LCS) AlgorithmDarshit Metaliya
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IMohamed Loey
 
Introduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic NotationIntroduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic NotationAmrinder Arora
 
Discrete Mathematics Lecture Notes
Discrete Mathematics Lecture NotesDiscrete Mathematics Lecture Notes
Discrete Mathematics Lecture NotesFellowBuddy.com
 
Presentation on flynn’s classification
Presentation on flynn’s classificationPresentation on flynn’s classification
Presentation on flynn’s classificationvani gupta
 

Was ist angesagt? (20)

introduction to graph theory
introduction to graph theoryintroduction to graph theory
introduction to graph theory
 
Longest Common Subsequence
Longest Common SubsequenceLongest Common Subsequence
Longest Common Subsequence
 
Fuzzy logic - Approximate reasoning
Fuzzy logic - Approximate reasoningFuzzy logic - Approximate reasoning
Fuzzy logic - Approximate reasoning
 
Overlapping clusters for distributed computation
Overlapping clusters for distributed computationOverlapping clusters for distributed computation
Overlapping clusters for distributed computation
 
Islam and-science
Islam and-scienceIslam and-science
Islam and-science
 
Ai lecture 11(unit03)
Ai lecture  11(unit03)Ai lecture  11(unit03)
Ai lecture 11(unit03)
 
Dempster shafer theory
Dempster shafer theoryDempster shafer theory
Dempster shafer theory
 
BINARY SEARCH TREE
BINARY SEARCH TREE BINARY SEARCH TREE
BINARY SEARCH TREE
 
Tsp branch and bound
Tsp branch and boundTsp branch and bound
Tsp branch and bound
 
computer-organization-and-architecture-9780070083332-0070083339_compress.pdf
computer-organization-and-architecture-9780070083332-0070083339_compress.pdfcomputer-organization-and-architecture-9780070083332-0070083339_compress.pdf
computer-organization-and-architecture-9780070083332-0070083339_compress.pdf
 
Introduction to Overleaf Workshop
Introduction to Overleaf WorkshopIntroduction to Overleaf Workshop
Introduction to Overleaf Workshop
 
Collision prevention on computer architecture
Collision prevention on computer architectureCollision prevention on computer architecture
Collision prevention on computer architecture
 
CLOSEST PAIR (Final)
CLOSEST PAIR (Final)CLOSEST PAIR (Final)
CLOSEST PAIR (Final)
 
Longest Common Subsequence (LCS) Algorithm
Longest Common Subsequence (LCS) AlgorithmLongest Common Subsequence (LCS) Algorithm
Longest Common Subsequence (LCS) Algorithm
 
Os(18 cs43) module5
Os(18 cs43) module5Os(18 cs43) module5
Os(18 cs43) module5
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms I
 
Introduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic NotationIntroduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic Notation
 
Fuzzy sets and operators
Fuzzy sets and operators Fuzzy sets and operators
Fuzzy sets and operators
 
Discrete Mathematics Lecture Notes
Discrete Mathematics Lecture NotesDiscrete Mathematics Lecture Notes
Discrete Mathematics Lecture Notes
 
Presentation on flynn’s classification
Presentation on flynn’s classificationPresentation on flynn’s classification
Presentation on flynn’s classification
 

Ähnlich wie Parallel quicksort cz. 1

Quick sort by Sania Nisar
Quick sort by Sania NisarQuick sort by Sania Nisar
Quick sort by Sania NisarSania Nisar
 
Dsa – data structure and algorithms sorting
Dsa – data structure and algorithms  sortingDsa – data structure and algorithms  sorting
Dsa – data structure and algorithms sortingsajinis3
 
Algorithms with-java-advanced-1.0
Algorithms with-java-advanced-1.0Algorithms with-java-advanced-1.0
Algorithms with-java-advanced-1.0BG Java EE Course
 
Class13_Quicksort_Algorithm.pdf
Class13_Quicksort_Algorithm.pdfClass13_Quicksort_Algorithm.pdf
Class13_Quicksort_Algorithm.pdfAkashSingh625550
 
CSE680-07QuickSort.pptx
CSE680-07QuickSort.pptxCSE680-07QuickSort.pptx
CSE680-07QuickSort.pptxDeepakM509554
 
Selection sort
Selection sortSelection sort
Selection sortasra khan
 
An Experiment to Determine and Compare Practical Efficiency of Insertion Sort...
An Experiment to Determine and Compare Practical Efficiency of Insertion Sort...An Experiment to Determine and Compare Practical Efficiency of Insertion Sort...
An Experiment to Determine and Compare Practical Efficiency of Insertion Sort...Tosin Amuda
 
Selection sort
Selection sortSelection sort
Selection sortamna izzat
 
Selection sort lab mannual
Selection sort lab mannualSelection sort lab mannual
Selection sort lab mannualmaamir farooq
 
Algorithms - "Chapter 2 getting started"
Algorithms - "Chapter 2 getting started"Algorithms - "Chapter 2 getting started"
Algorithms - "Chapter 2 getting started"Ra'Fat Al-Msie'deen
 
Chp-1 Quick Review of basic concepts.pdf
Chp-1 Quick Review of basic concepts.pdfChp-1 Quick Review of basic concepts.pdf
Chp-1 Quick Review of basic concepts.pdfSolomonMolla4
 
Sorting Algorithms.
Sorting Algorithms.Sorting Algorithms.
Sorting Algorithms.Saket Kumar
 

Ähnlich wie Parallel quicksort cz. 1 (20)

Quick sort by Sania Nisar
Quick sort by Sania NisarQuick sort by Sania Nisar
Quick sort by Sania Nisar
 
Dsa – data structure and algorithms sorting
Dsa – data structure and algorithms  sortingDsa – data structure and algorithms  sorting
Dsa – data structure and algorithms sorting
 
Sorting pnk
Sorting pnkSorting pnk
Sorting pnk
 
Sorting
SortingSorting
Sorting
 
Algorithms with-java-advanced-1.0
Algorithms with-java-advanced-1.0Algorithms with-java-advanced-1.0
Algorithms with-java-advanced-1.0
 
Class13_Quicksort_Algorithm.pdf
Class13_Quicksort_Algorithm.pdfClass13_Quicksort_Algorithm.pdf
Class13_Quicksort_Algorithm.pdf
 
CSE680-07QuickSort.pptx
CSE680-07QuickSort.pptxCSE680-07QuickSort.pptx
CSE680-07QuickSort.pptx
 
Selection sort
Selection sortSelection sort
Selection sort
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
 
An Experiment to Determine and Compare Practical Efficiency of Insertion Sort...
An Experiment to Determine and Compare Practical Efficiency of Insertion Sort...An Experiment to Determine and Compare Practical Efficiency of Insertion Sort...
An Experiment to Determine and Compare Practical Efficiency of Insertion Sort...
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
 
Selection sort
Selection sortSelection sort
Selection sort
 
simple-sorting algorithms
simple-sorting algorithmssimple-sorting algorithms
simple-sorting algorithms
 
Selection sort
Selection sortSelection sort
Selection sort
 
Selection sort lab mannual
Selection sort lab mannualSelection sort lab mannual
Selection sort lab mannual
 
Algorithms - "Chapter 2 getting started"
Algorithms - "Chapter 2 getting started"Algorithms - "Chapter 2 getting started"
Algorithms - "Chapter 2 getting started"
 
Chp-1 Quick Review of basic concepts.pdf
Chp-1 Quick Review of basic concepts.pdfChp-1 Quick Review of basic concepts.pdf
Chp-1 Quick Review of basic concepts.pdf
 
Data Structures 6
Data Structures 6Data Structures 6
Data Structures 6
 
Lec 03 - Sorting.pptx
Lec 03 - Sorting.pptxLec 03 - Sorting.pptx
Lec 03 - Sorting.pptx
 
Sorting Algorithms.
Sorting Algorithms.Sorting Algorithms.
Sorting Algorithms.
 

Mehr von Mikołaj Olszewski

The metadata driven e-laboratory web client
The metadata driven e-laboratory web clientThe metadata driven e-laboratory web client
The metadata driven e-laboratory web clientMikołaj Olszewski
 
Optoelektroniczne modelowanie sieci neuronowej cz. 1
Optoelektroniczne modelowanie sieci neuronowej cz. 1Optoelektroniczne modelowanie sieci neuronowej cz. 1
Optoelektroniczne modelowanie sieci neuronowej cz. 1Mikołaj Olszewski
 
Programowanie Komponentowe: #E Podsumowanie
Programowanie Komponentowe: #E PodsumowanieProgramowanie Komponentowe: #E Podsumowanie
Programowanie Komponentowe: #E PodsumowanieMikołaj Olszewski
 
Programowanie Komponentowe: #D Model komponentowy OSGi
Programowanie Komponentowe: #D Model komponentowy OSGiProgramowanie Komponentowe: #D Model komponentowy OSGi
Programowanie Komponentowe: #D Model komponentowy OSGiMikołaj Olszewski
 
Programowanie Komponentowe: #C Wprowadzenie do OSGi
Programowanie Komponentowe: #C Wprowadzenie do OSGiProgramowanie Komponentowe: #C Wprowadzenie do OSGi
Programowanie Komponentowe: #C Wprowadzenie do OSGiMikołaj Olszewski
 
Programowanie Komponentowe: #B Komponentowe aspekty springa
Programowanie Komponentowe: #B Komponentowe aspekty springaProgramowanie Komponentowe: #B Komponentowe aspekty springa
Programowanie Komponentowe: #B Komponentowe aspekty springaMikołaj Olszewski
 
Optoelektroniczne sieci neuronowe
Optoelektroniczne sieci neuronoweOptoelektroniczne sieci neuronowe
Optoelektroniczne sieci neuronoweMikołaj Olszewski
 
Programowanie Komponentowe: #A Wprowadzenie do Springa
Programowanie Komponentowe: #A Wprowadzenie do SpringaProgramowanie Komponentowe: #A Wprowadzenie do Springa
Programowanie Komponentowe: #A Wprowadzenie do SpringaMikołaj Olszewski
 
Programowanie Komponentowe: #9 Java Beans
Programowanie Komponentowe: #9 Java BeansProgramowanie Komponentowe: #9 Java Beans
Programowanie Komponentowe: #9 Java BeansMikołaj Olszewski
 
Optyczne solitony przestrzenne
Optyczne solitony przestrzenneOptyczne solitony przestrzenne
Optyczne solitony przestrzenneMikołaj Olszewski
 
Kwantowe struktury półprzewodnikowe
Kwantowe struktury półprzewodnikoweKwantowe struktury półprzewodnikowe
Kwantowe struktury półprzewodnikoweMikołaj Olszewski
 
Programowanie Komponentowe: #7 Programowanie asynchroniczne i sterowane zdarz...
Programowanie Komponentowe: #7 Programowanie asynchroniczne i sterowane zdarz...Programowanie Komponentowe: #7 Programowanie asynchroniczne i sterowane zdarz...
Programowanie Komponentowe: #7 Programowanie asynchroniczne i sterowane zdarz...Mikołaj Olszewski
 
Metody efektywnego łączenia sieci neuronowych
Metody efektywnego łączenia sieci neuronowychMetody efektywnego łączenia sieci neuronowych
Metody efektywnego łączenia sieci neuronowychMikołaj Olszewski
 
Programowanie Komponentowe: #6 Wersjonowanie
Programowanie Komponentowe: #6 WersjonowanieProgramowanie Komponentowe: #6 Wersjonowanie
Programowanie Komponentowe: #6 WersjonowanieMikołaj Olszewski
 

Mehr von Mikołaj Olszewski (20)

Architektura heksagonalna
Architektura heksagonalnaArchitektura heksagonalna
Architektura heksagonalna
 
The metadata driven e-laboratory web client
The metadata driven e-laboratory web clientThe metadata driven e-laboratory web client
The metadata driven e-laboratory web client
 
Optoelektroniczne modelowanie sieci neuronowej cz. 1
Optoelektroniczne modelowanie sieci neuronowej cz. 1Optoelektroniczne modelowanie sieci neuronowej cz. 1
Optoelektroniczne modelowanie sieci neuronowej cz. 1
 
Programowanie Komponentowe: #E Podsumowanie
Programowanie Komponentowe: #E PodsumowanieProgramowanie Komponentowe: #E Podsumowanie
Programowanie Komponentowe: #E Podsumowanie
 
Programowanie Komponentowe: #D Model komponentowy OSGi
Programowanie Komponentowe: #D Model komponentowy OSGiProgramowanie Komponentowe: #D Model komponentowy OSGi
Programowanie Komponentowe: #D Model komponentowy OSGi
 
Programowanie Komponentowe: #C Wprowadzenie do OSGi
Programowanie Komponentowe: #C Wprowadzenie do OSGiProgramowanie Komponentowe: #C Wprowadzenie do OSGi
Programowanie Komponentowe: #C Wprowadzenie do OSGi
 
Programowanie Komponentowe: #B Komponentowe aspekty springa
Programowanie Komponentowe: #B Komponentowe aspekty springaProgramowanie Komponentowe: #B Komponentowe aspekty springa
Programowanie Komponentowe: #B Komponentowe aspekty springa
 
Optoelektroniczne sieci neuronowe
Optoelektroniczne sieci neuronoweOptoelektroniczne sieci neuronowe
Optoelektroniczne sieci neuronowe
 
Programowanie Komponentowe: #A Wprowadzenie do Springa
Programowanie Komponentowe: #A Wprowadzenie do SpringaProgramowanie Komponentowe: #A Wprowadzenie do Springa
Programowanie Komponentowe: #A Wprowadzenie do Springa
 
Materiały fotorefrakcyjne
Materiały fotorefrakcyjneMateriały fotorefrakcyjne
Materiały fotorefrakcyjne
 
Programowanie Komponentowe: #9 Java Beans
Programowanie Komponentowe: #9 Java BeansProgramowanie Komponentowe: #9 Java Beans
Programowanie Komponentowe: #9 Java Beans
 
Lokalne sieci światłowodowe
Lokalne sieci światłowodoweLokalne sieci światłowodowe
Lokalne sieci światłowodowe
 
Optyczne solitony przestrzenne
Optyczne solitony przestrzenneOptyczne solitony przestrzenne
Optyczne solitony przestrzenne
 
Swiatłowodowy czujnik prądu
Swiatłowodowy czujnik prąduSwiatłowodowy czujnik prądu
Swiatłowodowy czujnik prądu
 
Optyka ciekłych kryształów
Optyka ciekłych kryształówOptyka ciekłych kryształów
Optyka ciekłych kryształów
 
Kwantowe struktury półprzewodnikowe
Kwantowe struktury półprzewodnikoweKwantowe struktury półprzewodnikowe
Kwantowe struktury półprzewodnikowe
 
Programowanie Komponentowe: #7 Programowanie asynchroniczne i sterowane zdarz...
Programowanie Komponentowe: #7 Programowanie asynchroniczne i sterowane zdarz...Programowanie Komponentowe: #7 Programowanie asynchroniczne i sterowane zdarz...
Programowanie Komponentowe: #7 Programowanie asynchroniczne i sterowane zdarz...
 
Metody efektywnego łączenia sieci neuronowych
Metody efektywnego łączenia sieci neuronowychMetody efektywnego łączenia sieci neuronowych
Metody efektywnego łączenia sieci neuronowych
 
Parallel quicksort cz. 2
Parallel quicksort cz. 2Parallel quicksort cz. 2
Parallel quicksort cz. 2
 
Programowanie Komponentowe: #6 Wersjonowanie
Programowanie Komponentowe: #6 WersjonowanieProgramowanie Komponentowe: #6 Wersjonowanie
Programowanie Komponentowe: #6 Wersjonowanie
 

Kürzlich hochgeladen

The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 

Kürzlich hochgeladen (20)

The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 

Parallel quicksort cz. 1

  • 1. Parallel quicksort Sylwia Dzikiewicz Marta Leniewska Mikołaj Olszewski Marcin Woch Michał Żelazowski
  • 2. Sequential quicksort  Quicksort (Array, start, end) If (start < end) middle = partition (Array, start, end) quicksort(Array, start, middle) quicksort(Array, middle+1, end)
  • 3. Sequential quicksort  Partition (Array, start, end) X = Array [start] I = start - 1 J = end + 1 while TRUE repeat J = J –1 until Array [ J ] <= X repeat I = I +1 until Array [ I ] >=X if I < J swap (Array [ I ], Array [ J ] ) else return J
  • 4. Sequential quicksort – complexity analysis  Pessimistic – O (n2)  Average – complexity complexity O (n log n)
  • 5. Parallel quicksort P a r a lle l q u ic k s o rt Q s o rt Q s o rt Q s o rt Q s o rt Q s o rt Q s o rt Q s o rt Q s o rt Q s o rt Q s o rt Q s o rt
  • 6. Parallel quicksort  How a single processor makes QuickSort (Array, start, end) – – – – – J = Partition (Array, start, end) Start a new thread on another processor : QuickSort(Array, start, J) Start a new thread on another processor : QuickSort(Array, J+1, end) Wait for both threads to complete Notice your parent that your task is finished
  • 7. Parallel quicksort  OR – – – – – : J = Partition (Array, start, end) Start a new thread on another processor : QuickSort(Array, start, J) Execute QuickSort(Array, J+1, end) Wait for the thread to complete Notice your parent that your task is finished
  • 8. Parallel quicksort  In case no processor can take thread, the thread is put into a queue for later processing.  After a processor has done its task, it checks whether the queue contains any waiting threads. If so, it removes the first task from the queue and processes it.
  • 9. Parallel quicksort  Methods – – – of choosing the split key First element Average of : first, last and medium element Median (the median of a sample is expected to be the median of the whole array)
  • 10. Parallel quicksort A new thread is created only if the length of the array to sort is no less than MIN_ARRAY_SIZE constant  If the length of the array to sort is less than MIN_QUICKSORT_SIZE, the array is sorted using a simple algorithm (eg. Insertionsort or Selectionsort), which require no new threads.  MIN_QUICKSORT_SIZE <= MIN_ARRAY_SIZE