Spark ICP2 - neerajpadarthi/Big-Data-Programming GitHub Wiki

Name : Neeraj Padarthi

Class ID: 19

Spark ICP : 2

Topic: Apache Spark

  • Implementing Merge Sort Algorithm
  • Implementing Depth First Sort Algorithm

Merge Sort

  • Merge Sort is a Divide and Conquer algorithm
  • It divides input array into two halves, calls itself for the two halves and then merges the two sorted halves
  • The merge () function is used for merging two halves
  • The merge (arr, l, m, r) is key process that assumes that arr[l..m] and arr[m+1..r] are sorted and merges the two sorted sub-arrays into one

Input

Output

Depth First Sorting

  • The depth-first algorithm sticks with one path, following that path down a graph structure until it ends. The breadth-first search approach, however, evaluates all the possible paths from a given node equally, checking all potential vertices from one node together, and comparing them simultaneously.

Input

Output