PDC Lec 11
PDC Lec 11
Computing
Week 9
Parallel Algorithms
1. Linked List
2. Arrays
3. Hypercube Network
Parallel Algorithms cont… Structure
• Each node has two or three parts − one data part that stores the data
and the other two are link fields that store the address of the
previous or next node.
Parallel Algorithms cont…
Structure (linked lists)
• The first node’s address is stored in an external pointer called head. The
last node, known as tail, generally does not contain any address. There are three
1. Statically
2. Dynamically
Parallel Algorithms cont…
Structure (Arrays)
2. Greedy Method
3. Dynamic Programming
4. Backtracking
Parallel Algorithms cont… Design
Technique (Divide and Conquer)
small sub-problems.
• The divide and conquer approach involves the following steps at each level:
Parallel Algorithms cont… Design
Technique (Divide and Conquer)
1. Binary search
2. Quick sort
3. Merge sort
4. Matrix multiplication
Parallel Algorithms cont… Design
Technique (Divide and Conquer)
Sorting Example: Divide and Conquer Rule
Sort
the array [14, 10, 4, 8, 2, 12, 6, 0] in the
ascending order
Solution:
Divide
14, 10, 4, 8, 2, 12, 6,0
Merge-sort
Merge-sort Merge-sort
14, 10 4, 8 2, 12 6, 0
Merge-sort Merge-sort Merge-sort Merge-sort
14 10 4 8 2 12 6 0
Recursion and Conquer Contd..
0, 2, 4, 6, 8, 10, 12, 14
Merge
4, 8, 10, 14 0, 2, 6, 12
Merge Merge
10, 14 4, 8 2, 12 0, 6
Merge Merge Merge Merge
14 10 4 8 2 12 6 0
Parallel Algorithms cont… Design
Technique (Greedy Algorithm)
• Then we move to the next level and if that level does not
produce a satisfactory solution, we return one level back and start with a
new option.
Design Technique (Backtracking)
Synchronization:
Once a solution is found (or if all branches are explored), the
processors need to synchronize. This can involve checking if
any processor has found the desired solution and then
terminating the search across all processors.
If no solution is found, all processors will continue until they
have fully explored the search space.
Thank you