SlideShare a Scribd company logo
Bitonic Sort Algorithm
is a comparison-based parallel algorithm for
sorting. It’s basically based on what is called
the Bitonic seuence.
Bitonic Sort Algorithm
Advantages include its parallelism
and suitability for large datasets.
Limitations include the requirement for
input sizes to be powers (2n
) of two and
its potentially slower performance on
regular CPUs compared to other sorting
algorithms.
Bitonic Sort Algorithm
Parallel Sorting algorithms are designed
to Perform many comparisons in
parallel, Data distributed among multiple
processors.
They can be used to solve a wide range
of problems, including sorting,
searching, matrix multiplication, and
more.
Parallel Algorithms
l . Concurrency
2. Divide and Conquer
3. Efficient Scaling with more
processing units
Key Features
definition: series of numbers that is first increasing, and then decreasing
Bitonic Sort relies on the concept of Bitonic Sequences as its fundamental building block.
The sorting process in Bitonic Sort works by repeatedly merging or sorting smaller Bitonic
Sequences.
Examples:
Ascending Bitonic Sequence: [1, 3, 5, 7, 9, 8, 6, 4, 2]
Descending Bitonic Sequence: [8, 6, 4, 2, 1
, 3, 5, 7, 9]
Bitonic Sequence with Multiple Bitonic Points: [2, 5, 8, 7, 6, 9, 10, 4, 3, 1
]
Bitonic Sequence
Creating a bitonic sequence
Creating a bitonic sequence
Initialization (Divide into smaller
bitonic sequences)
Bitonic Merge (compare and swap
elements to ensure the bitonic
pattern) Final Merge (Perform a final
bitonic merge to create a fully sorted
sequence.
Steps of the Algorithm
Example:
Array: [8 3 4 9 6 2 1 7]
Divide: [[8 3 4 9]a [6 2 1 7]d]a
Divide [[[8 3]a [4 9]d]a [[6 2]a [1 7]d]d]a
Divide [[[[8] [3]]a [[4] [9]]d]a [[[6] [2]]a [[1] [7]]d]d]a
Merge each 2: [[[3 8]a [9 4]d]a [[2 6]a [7 1]d]d]a
Merge each 4: [[[3 4] [9 8]]a [[7 6] [2 1]]d]a
Merge the whole: [[3 4 8 9]a [7 6 2 1]d]a
Result: [[3 4 2 1] [7 6 8 9]]a
Merge each 4: [[[2 1] [3 4]] [[7 6] [8 9]]]a
Merge each 2: [[[1 2] [3 4]] [[6 7] [8 9]]]a
Result: [1 2 3 4 6 7 8 9]a
Pseudo Code
function BitonicSort(arr, low, cnt, direction):
if cnt > 1:
k = cnt / 2
Async BitonicSort(arr, low, k, true)
Async BitonicSort(arr, low + k, k, false)
BitonicMerge(arr, low, cnt, direction)
function BitonicMerge(arr, low, cnt, direction):
if cnt > 1:
k = cnt / 2
for i in range(low, low + k):
if (arr[i] > arr[i + k]) ==
direction:
swap(arr[i], arr[i +
k])
Async BitonicMerge(arr, low, k, direction)
Analysis
function BitonicSort(arr, low, cnt, direction): // T(n)
if cnt > 1:
k = cnt / 2;
BitonicSort(arr, low, k, true); //T(n/2)
BitonicSort(arr, low + k, k, false); //T(n/2)
BitonicMerge(arr, low, cnt, direction); //C(n)
Analysis
function BitonicMerge(arr, low, cnt, direction): // C(n)
if cnt > 1: k = cnt / 2;
for i in range(low, low + k): // n/2
if (arr[i] > arr[i + k]) == direction:
swap(arr[i], arr[i + k]);
BitonicMerge(arr, low, k, direction); // C(n/2)
BitonicMerge(arr, low + k, k, direction); // C(n/2)
Analysis
Basic Operation: Key Comparison, T(n) = # of key comparisons
Input Size: n
T(n) = T(n/2) + T(n/2) + C(n) // n > 1, for n = 1 -> T(n) = 0
T(n) = 2T(n/2) + n/2 * log(n) // n/2 comparisons occurs log(n) times
Let n = 2k
, take the log -> k = log(n)
T(2k
) = 2T(2k
/ 2) + (2k
/ 2) * k
= 2T(2k-1
) + (2k-1
) * k
= 2[2T(2k-2
) + (2k-2
) * k] + (2k-1
) * k
= 22
T(2k-2
) + (2k-1
) * k + (2k-1
) * k
= 22
T(2k-2
) + 2 * [(2k-1
) * k]
Analysis
T(2k
) = 22
T(2k-2
) + 2 * [(2k-1
) * k]
= 22
[2T(2k-3
) + (2k-3
) * k] + 2 * [(2k-1
) * k]
= 23
T(2k-3
) + (2k-1
) * k + 2 * [(2k-1
) * k]
= 23
T(2k-3
) + 3 * [(2k-1
) * k]
= 2i
T(2k-i
) + i * [(2k-1
) * k]
Let i = k =>
= 2k
T(1) + k2
* 2k-1
// for T(1) no comparisons, T(1) = 0
= k2
* 2k-1
Analysis
T(2k
) = k2
* 2k-1
T(n) = log2
(n) * n/2 // from [Let n = 2k
-> k = log(n)]
T(n) = O(n*log2
(n)) // in best, average and worst
BitonicSort: comparison-based
sorting algorithm which sorts a
data-set by converting the list of
numbers into a bitonic sequence.
A series of numbers which
monotonically increases,
then decreases
The list is then sorted using
a merge
Conclusion
Thanks!
Any
questions?
Ad

More Related Content

Similar to Demonstration/explanation of Bitonic Sort Algorithm (20)

Algorithim lec1.pptx
Algorithim lec1.pptxAlgorithim lec1.pptx
Algorithim lec1.pptx
rediet43
 
coefficient variation
coefficient variationcoefficient variation
coefficient variation
MARIA KATRINA MACAPAZ
 
R Matrix Math Quick Reference
R Matrix Math Quick ReferenceR Matrix Math Quick Reference
R Matrix Math Quick Reference
Mark Niemann-Ross
 
Merge sort analysis and its real time applications
Merge sort analysis and its real time applicationsMerge sort analysis and its real time applications
Merge sort analysis and its real time applications
yazad dumasia
 
Cis435 week01
Cis435 week01Cis435 week01
Cis435 week01
ashish bansal
 
Idea for ineractive programming language
Idea for ineractive programming languageIdea for ineractive programming language
Idea for ineractive programming language
Lincoln Hannah
 
Project Report
Project ReportProject Report
Project Report
Thomas Fletcher
 
Unit- 2_my1.pdf jbvjwe vbeijv dv d d d kjd k
Unit- 2_my1.pdf jbvjwe vbeijv dv d  d d kjd kUnit- 2_my1.pdf jbvjwe vbeijv dv d  d d kjd k
Unit- 2_my1.pdf jbvjwe vbeijv dv d d d kjd k
bhattkathit123
 
Proyecto parcial ii_grupo2.docx
Proyecto parcial ii_grupo2.docxProyecto parcial ii_grupo2.docx
Proyecto parcial ii_grupo2.docx
LuisCuevaFlores
 
Chapter 1 digital design.pptx
Chapter 1 digital design.pptxChapter 1 digital design.pptx
Chapter 1 digital design.pptx
AliaaTarek5
 
Alg_Wks1_2.pdflklokjbhvkv jv .v.vk.hk kv h/k
Alg_Wks1_2.pdflklokjbhvkv jv .v.vk.hk kv h/kAlg_Wks1_2.pdflklokjbhvkv jv .v.vk.hk kv h/k
Alg_Wks1_2.pdflklokjbhvkv jv .v.vk.hk kv h/k
227567
 
Quick sort,bubble sort,heap sort and merge sort
Quick sort,bubble sort,heap sort and merge sortQuick sort,bubble sort,heap sort and merge sort
Quick sort,bubble sort,heap sort and merge sort
abhinavkumar77723
 
Wave File Features Extraction using Reduced LBP
Wave File Features Extraction using Reduced LBP Wave File Features Extraction using Reduced LBP
Wave File Features Extraction using Reduced LBP
IJECEIAES
 
Effective Numerical Computation in NumPy and SciPy
Effective Numerical Computation in NumPy and SciPyEffective Numerical Computation in NumPy and SciPy
Effective Numerical Computation in NumPy and SciPy
Kimikazu Kato
 
Workshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Workshop "Can my .NET application use less CPU / RAM?", Yevhen TatarynovWorkshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Workshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Fwdays
 
Computer Science CS Project Matrix CBSE Class 12th XII .pdf
Computer Science CS Project Matrix CBSE Class 12th XII .pdfComputer Science CS Project Matrix CBSE Class 12th XII .pdf
Computer Science CS Project Matrix CBSE Class 12th XII .pdf
PranavAnil9
 
Developing digital signal clustering method using local binary pattern histog...
Developing digital signal clustering method using local binary pattern histog...Developing digital signal clustering method using local binary pattern histog...
Developing digital signal clustering method using local binary pattern histog...
IJECEIAES
 
R Programming Homework Help
R Programming Homework HelpR Programming Homework Help
R Programming Homework Help
Statistics Homework Helper
 
Advance data structure & algorithm
Advance data structure & algorithmAdvance data structure & algorithm
Advance data structure & algorithm
K Hari Shankar
 
Basic operations by novi reandy sasmita
Basic operations by novi reandy sasmitaBasic operations by novi reandy sasmita
Basic operations by novi reandy sasmita
beasiswa
 
Algorithim lec1.pptx
Algorithim lec1.pptxAlgorithim lec1.pptx
Algorithim lec1.pptx
rediet43
 
R Matrix Math Quick Reference
R Matrix Math Quick ReferenceR Matrix Math Quick Reference
R Matrix Math Quick Reference
Mark Niemann-Ross
 
Merge sort analysis and its real time applications
Merge sort analysis and its real time applicationsMerge sort analysis and its real time applications
Merge sort analysis and its real time applications
yazad dumasia
 
Idea for ineractive programming language
Idea for ineractive programming languageIdea for ineractive programming language
Idea for ineractive programming language
Lincoln Hannah
 
Unit- 2_my1.pdf jbvjwe vbeijv dv d d d kjd k
Unit- 2_my1.pdf jbvjwe vbeijv dv d  d d kjd kUnit- 2_my1.pdf jbvjwe vbeijv dv d  d d kjd k
Unit- 2_my1.pdf jbvjwe vbeijv dv d d d kjd k
bhattkathit123
 
Proyecto parcial ii_grupo2.docx
Proyecto parcial ii_grupo2.docxProyecto parcial ii_grupo2.docx
Proyecto parcial ii_grupo2.docx
LuisCuevaFlores
 
Chapter 1 digital design.pptx
Chapter 1 digital design.pptxChapter 1 digital design.pptx
Chapter 1 digital design.pptx
AliaaTarek5
 
Alg_Wks1_2.pdflklokjbhvkv jv .v.vk.hk kv h/k
Alg_Wks1_2.pdflklokjbhvkv jv .v.vk.hk kv h/kAlg_Wks1_2.pdflklokjbhvkv jv .v.vk.hk kv h/k
Alg_Wks1_2.pdflklokjbhvkv jv .v.vk.hk kv h/k
227567
 
Quick sort,bubble sort,heap sort and merge sort
Quick sort,bubble sort,heap sort and merge sortQuick sort,bubble sort,heap sort and merge sort
Quick sort,bubble sort,heap sort and merge sort
abhinavkumar77723
 
Wave File Features Extraction using Reduced LBP
Wave File Features Extraction using Reduced LBP Wave File Features Extraction using Reduced LBP
Wave File Features Extraction using Reduced LBP
IJECEIAES
 
Effective Numerical Computation in NumPy and SciPy
Effective Numerical Computation in NumPy and SciPyEffective Numerical Computation in NumPy and SciPy
Effective Numerical Computation in NumPy and SciPy
Kimikazu Kato
 
Workshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Workshop "Can my .NET application use less CPU / RAM?", Yevhen TatarynovWorkshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Workshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Fwdays
 
Computer Science CS Project Matrix CBSE Class 12th XII .pdf
Computer Science CS Project Matrix CBSE Class 12th XII .pdfComputer Science CS Project Matrix CBSE Class 12th XII .pdf
Computer Science CS Project Matrix CBSE Class 12th XII .pdf
PranavAnil9
 
Developing digital signal clustering method using local binary pattern histog...
Developing digital signal clustering method using local binary pattern histog...Developing digital signal clustering method using local binary pattern histog...
Developing digital signal clustering method using local binary pattern histog...
IJECEIAES
 
Advance data structure & algorithm
Advance data structure & algorithmAdvance data structure & algorithm
Advance data structure & algorithm
K Hari Shankar
 
Basic operations by novi reandy sasmita
Basic operations by novi reandy sasmitaBasic operations by novi reandy sasmita
Basic operations by novi reandy sasmita
beasiswa
 

Recently uploaded (20)

Lecture 4 INSECT CUTICLE and moulting.pptx
Lecture 4 INSECT CUTICLE and moulting.pptxLecture 4 INSECT CUTICLE and moulting.pptx
Lecture 4 INSECT CUTICLE and moulting.pptx
Arshad Shaikh
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18
Celine George
 
Link your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRMLink your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRM
Celine George
 
APM Midlands Region April 2025 Sacha Hind Circulated.pdf
APM Midlands Region April 2025 Sacha Hind Circulated.pdfAPM Midlands Region April 2025 Sacha Hind Circulated.pdf
APM Midlands Region April 2025 Sacha Hind Circulated.pdf
Association for Project Management
 
dynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south Indiadynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south India
PrachiSontakke5
 
Debunking the Myths behind AI - v1, Carl Dalby
Debunking the Myths behind AI -  v1, Carl DalbyDebunking the Myths behind AI -  v1, Carl Dalby
Debunking the Myths behind AI - v1, Carl Dalby
Association for Project Management
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx   quiz by Ridip HazarikaTHE STG QUIZ GROUP D.pptx   quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
Ridip Hazarika
 
How to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 SalesHow to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 Sales
Celine George
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
Lecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptxLecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptx
Arshad Shaikh
 
How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18
Celine George
 
Drive Supporter Growth from Awareness to Advocacy with TechSoup Marketing Ser...
Drive Supporter Growth from Awareness to Advocacy with TechSoup Marketing Ser...Drive Supporter Growth from Awareness to Advocacy with TechSoup Marketing Ser...
Drive Supporter Growth from Awareness to Advocacy with TechSoup Marketing Ser...
TechSoup
 
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFAExercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
Kenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 CohortKenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 Cohort
EducationNC
 
Rococo versus Neoclassicism. The artistic styles of the 18th century
Rococo versus Neoclassicism. The artistic styles of the 18th centuryRococo versus Neoclassicism. The artistic styles of the 18th century
Rococo versus Neoclassicism. The artistic styles of the 18th century
Gema
 
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
Nguyen Thanh Tu Collection
 
Lecture 4 INSECT CUTICLE and moulting.pptx
Lecture 4 INSECT CUTICLE and moulting.pptxLecture 4 INSECT CUTICLE and moulting.pptx
Lecture 4 INSECT CUTICLE and moulting.pptx
Arshad Shaikh
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18
Celine George
 
Link your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRMLink your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRM
Celine George
 
dynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south Indiadynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south India
PrachiSontakke5
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx   quiz by Ridip HazarikaTHE STG QUIZ GROUP D.pptx   quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
Ridip Hazarika
 
How to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 SalesHow to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 Sales
Celine George
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
Lecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptxLecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptx
Arshad Shaikh
 
How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18
Celine George
 
Drive Supporter Growth from Awareness to Advocacy with TechSoup Marketing Ser...
Drive Supporter Growth from Awareness to Advocacy with TechSoup Marketing Ser...Drive Supporter Growth from Awareness to Advocacy with TechSoup Marketing Ser...
Drive Supporter Growth from Awareness to Advocacy with TechSoup Marketing Ser...
TechSoup
 
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFAExercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
Kenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 CohortKenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 Cohort
EducationNC
 
Rococo versus Neoclassicism. The artistic styles of the 18th century
Rococo versus Neoclassicism. The artistic styles of the 18th centuryRococo versus Neoclassicism. The artistic styles of the 18th century
Rococo versus Neoclassicism. The artistic styles of the 18th century
Gema
 
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
Nguyen Thanh Tu Collection
 
Ad

Demonstration/explanation of Bitonic Sort Algorithm

  • 2. is a comparison-based parallel algorithm for sorting. It’s basically based on what is called the Bitonic seuence. Bitonic Sort Algorithm
  • 3. Advantages include its parallelism and suitability for large datasets. Limitations include the requirement for input sizes to be powers (2n ) of two and its potentially slower performance on regular CPUs compared to other sorting algorithms. Bitonic Sort Algorithm
  • 4. Parallel Sorting algorithms are designed to Perform many comparisons in parallel, Data distributed among multiple processors. They can be used to solve a wide range of problems, including sorting, searching, matrix multiplication, and more. Parallel Algorithms
  • 5. l . Concurrency 2. Divide and Conquer 3. Efficient Scaling with more processing units Key Features
  • 6. definition: series of numbers that is first increasing, and then decreasing Bitonic Sort relies on the concept of Bitonic Sequences as its fundamental building block. The sorting process in Bitonic Sort works by repeatedly merging or sorting smaller Bitonic Sequences. Examples: Ascending Bitonic Sequence: [1, 3, 5, 7, 9, 8, 6, 4, 2] Descending Bitonic Sequence: [8, 6, 4, 2, 1 , 3, 5, 7, 9] Bitonic Sequence with Multiple Bitonic Points: [2, 5, 8, 7, 6, 9, 10, 4, 3, 1 ] Bitonic Sequence
  • 9. Initialization (Divide into smaller bitonic sequences) Bitonic Merge (compare and swap elements to ensure the bitonic pattern) Final Merge (Perform a final bitonic merge to create a fully sorted sequence. Steps of the Algorithm
  • 10. Example: Array: [8 3 4 9 6 2 1 7] Divide: [[8 3 4 9]a [6 2 1 7]d]a Divide [[[8 3]a [4 9]d]a [[6 2]a [1 7]d]d]a Divide [[[[8] [3]]a [[4] [9]]d]a [[[6] [2]]a [[1] [7]]d]d]a Merge each 2: [[[3 8]a [9 4]d]a [[2 6]a [7 1]d]d]a Merge each 4: [[[3 4] [9 8]]a [[7 6] [2 1]]d]a Merge the whole: [[3 4 8 9]a [7 6 2 1]d]a Result: [[3 4 2 1] [7 6 8 9]]a Merge each 4: [[[2 1] [3 4]] [[7 6] [8 9]]]a Merge each 2: [[[1 2] [3 4]] [[6 7] [8 9]]]a Result: [1 2 3 4 6 7 8 9]a
  • 11. Pseudo Code function BitonicSort(arr, low, cnt, direction): if cnt > 1: k = cnt / 2 Async BitonicSort(arr, low, k, true) Async BitonicSort(arr, low + k, k, false) BitonicMerge(arr, low, cnt, direction) function BitonicMerge(arr, low, cnt, direction): if cnt > 1: k = cnt / 2 for i in range(low, low + k): if (arr[i] > arr[i + k]) == direction: swap(arr[i], arr[i + k]) Async BitonicMerge(arr, low, k, direction)
  • 12. Analysis function BitonicSort(arr, low, cnt, direction): // T(n) if cnt > 1: k = cnt / 2; BitonicSort(arr, low, k, true); //T(n/2) BitonicSort(arr, low + k, k, false); //T(n/2) BitonicMerge(arr, low, cnt, direction); //C(n)
  • 13. Analysis function BitonicMerge(arr, low, cnt, direction): // C(n) if cnt > 1: k = cnt / 2; for i in range(low, low + k): // n/2 if (arr[i] > arr[i + k]) == direction: swap(arr[i], arr[i + k]); BitonicMerge(arr, low, k, direction); // C(n/2) BitonicMerge(arr, low + k, k, direction); // C(n/2)
  • 14. Analysis Basic Operation: Key Comparison, T(n) = # of key comparisons Input Size: n T(n) = T(n/2) + T(n/2) + C(n) // n > 1, for n = 1 -> T(n) = 0 T(n) = 2T(n/2) + n/2 * log(n) // n/2 comparisons occurs log(n) times Let n = 2k , take the log -> k = log(n) T(2k ) = 2T(2k / 2) + (2k / 2) * k = 2T(2k-1 ) + (2k-1 ) * k = 2[2T(2k-2 ) + (2k-2 ) * k] + (2k-1 ) * k = 22 T(2k-2 ) + (2k-1 ) * k + (2k-1 ) * k = 22 T(2k-2 ) + 2 * [(2k-1 ) * k]
  • 15. Analysis T(2k ) = 22 T(2k-2 ) + 2 * [(2k-1 ) * k] = 22 [2T(2k-3 ) + (2k-3 ) * k] + 2 * [(2k-1 ) * k] = 23 T(2k-3 ) + (2k-1 ) * k + 2 * [(2k-1 ) * k] = 23 T(2k-3 ) + 3 * [(2k-1 ) * k] = 2i T(2k-i ) + i * [(2k-1 ) * k] Let i = k => = 2k T(1) + k2 * 2k-1 // for T(1) no comparisons, T(1) = 0 = k2 * 2k-1
  • 16. Analysis T(2k ) = k2 * 2k-1 T(n) = log2 (n) * n/2 // from [Let n = 2k -> k = log(n)] T(n) = O(n*log2 (n)) // in best, average and worst
  • 17. BitonicSort: comparison-based sorting algorithm which sorts a data-set by converting the list of numbers into a bitonic sequence. A series of numbers which monotonically increases, then decreases The list is then sorted using a merge Conclusion