Перейти к содержимому

Binary Search | Animated DSA Explanation in Java

AlgoRung

0:00 / 0:00

Binary Search | Animated DSA Explanation in Java

1 просмотр · 2 нед. назад
AlgoRung
9 подписчиков
1 просмотр · 2 нед. назад
Binary Search (Easy) explained step by step with animations: the idea, a brute force, the optimal solution and its complexity, with Java code. Given a sorted array of distinct integers and a target, return the index of target, or -1 if it is not present. The solution must be O(log n). Java code + notes: https://algorung.com/dsa/binary-searc... Practise it with spaced revision: https://algorung.com/app/problems/bin... Original problem (LeetCode): https://leetcode.com/problems/binary-... The 60-second version:    • Interview must-know: Binary Search, halve ...   Chapters 0:00 The problem 0:29 Check every element 0:44 Compare with the middle 1:06 Finding 30 1:45 Looking for 5 2:41 Complexity 2:59 Edge cases & recap Similar problems • Fundamentals: https://algorung.com/dsa/binary-searc... • bisect_left, bisect_right: https://algorung.com/dsa/binary-searc... • Search Insert Position: https://algorung.com/dsa/binary-searc... • Floor in a Sorted Array: https://algorung.com/dsa/binary-searc... More Binary Search problems: https://algorung.com/dsa/binary-search All patterns: https://algorung.com/patterns #DSA #BinarySearch #Java #CodingInterview #LeetCode #AlgoRung