Array - 15: Search a value in Unsorted & Sorted Array

preview_player
Показать описание
Solution:
For Unsorted Array:
- Start from 0th index & keep on checking the target value.
- Whenever you find the value, return the index, else return -1 at last

For Sorted Array:
- We'll apply binary search here.
- get middle index & check target value
- If value matches, return index.
- If target value greater than middle indexed value, it means, our target value lies in later half of array, so start = mid + 1
- If target value less than middle indexed value, it means, our target value lies in first half of array, so end = mid - 1

Please check video for more info:

This problem is similar to:
search a value in array,
search a value in sorted array,
find value a array,
sorted array,
search,
binary search,
array,
java tutorial,
coding simplified,
java

CHECK OUT CODING SIMPLIFIED

★☆★ VIEW THE BLOG POST: ★☆★

I started my YouTube channel, Coding Simplified, during Dec of 2015.
Since then, I've published over 400+ videos.

★☆★ SUBSCRIBE TO ME ON YOUTUBE: ★☆★

★☆★ Send us mail at: ★☆★
Рекомендации по теме
Комментарии
Автор

Please make a video on dynamic programming and recursion

simraj
welcome to shbcf.ru