filmov
tv
Sort K sorted array | Sort nearly sorted array

Показать описание
This video explains a very important programming interview problem which is to sort a nearly sorted array or a k sorted array.I have explained 3 approaches for solving this problem.In this problem, given an array we need to sort it.But the array has special property of being K-sorted, which means that each element is atmost K away from its actual position in a sorted array.I have shown how to make use of this property and solve the entire problem efficiently.The first method is by using simple sorting which takes O(NlogN) time.The second method is by using insertion sort and the third method is by using Heap.I have also shown comparision between all these methods.Code for both insertion sort and heap are explained at the end of the video.
CODE LINK is present below as usual. If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)
==========================================PLEASE DONATE=============================
==============================================================================
=======================================================================
USEFUL LINKS:
RELATED LINKS:
#heap #techdose #heapcourse
CODE LINK is present below as usual. If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)
==========================================PLEASE DONATE=============================
==============================================================================
=======================================================================
USEFUL LINKS:
RELATED LINKS:
#heap #techdose #heapcourse
Комментарии