Project 7

Project 7

Published on 24 October 2020
  • Facebook
  • Twitter
  • Linkedin
sk
srujash kshirsagar
srujash's Personal Gallery
Transcript
00:00
If you wanted to see this code in action, just call the mergeSort function with an array of numbers as the argument: var example = [4, 10, 11, 20, 5, 3, 4, 1, -20]; console.log(example); alert(example);
00:05
As you follow through the code, notice that there is absolutely nothing interesting going on here. It's just a lot of loop and array manipulations that make up the divide and merge/sort conquer operations. Now, if you aren't too familiar with how loops and arrays work in JavaScript, then this code is probably just gibberish. To turn this gibberish into something more meaningful, check out my two tutorials on Loops and Arrays!
00:10
If you wanted to sort a large list of values, you can't go wrong with using mergesort. It is fast, uses up a reasonable amount of memory, and (unlike quicksort) is stable. Now, before we call it a night and party it up mergesort at the local paintball range, below is a table comparing it with various other popular sorting algorithms and their performance and memory characteristics:
00:11
Conclusion
00:20
You can find a more detailed comparison of these sorting algorithms as well as many others over on the Wikipedia section fully dedicated to this. Got a question or just want to chat? Comment below or drop by our forums (they are actually the same thing!) where a bunch of the friendliest people you'll ever run into will be happy to help you out!
00:26
DSA ISE 1 srujash kshirsagar (1903102) shreya tadase (1903123)
00:30
THANK YOU