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=============================
🧡 SUPPORT OUR WORK: / techdose
💚 UPI-ID: surya.kahar@ybl
💞JOIN Membership: / @techdose4u
==============================================================================
INSTAGRAM : / surya.pratap.k
LinkedIn: / surya-pratap-kahar-47b...
WEBSITE: techdose.co.in/
TELEGRAM Channel LINK: t.me/codewithT...
TELEGRAM Group LINK: t.me/joinchat/...
=======================================================================
USEFUL LINKS:
🟠Must do TIPS to ACE Virtual Interview: • 🔴Must do Tips to ACE y...
🟢Best strategy to excel your coding interview: • 🔴Best strategy to exce...
🟡Get your dream job in 1 month: • 🔴Get your dream job in...
🔵How to crack dream job in just 2 months: • How to crack dream job...
🟣7 Days DSA plan: techdose.co.in...
RELATED LINKS:
Power of Heap: • Power of Heap
Concepts of Heap: • Concepts of Heap | Und...
Representation of Heap: • Representation of Heap...
Heapify Algorithm: • Heapify Algorithm | Ma...
Build heap algorithm: • Build Heap Algorithm |...
Heap Algorithm: • Heap Algorithms | Extr...
Heapsort Algorithm: • Heapsort Algorithm | C...
Heap Implementation: • Heap Implementation | ...
Top K frequent elements: • Top K Frequent Element...
CODE LINK: techdose.co.in...
#heap #techdose #heapcourse
Негізгі бет Sort K sorted array | Sort nearly sorted array
Пікірлер: 35