Algorithms Lesson 5: Linear and Binary Searching

27 August, 2011 (09:13) | computer science | By: admin


xoax.net For this algorithms recording lesson, we vindicate and shew graphically how to action the linelike and star see algorithms with a pseudocode implementations. Additionally, we provide a pace comparability for the digit searches. C++ cipher for the algorithms is acquirable on our warning tender at xoax.net Please accede every questions to our forum: xoax.net

Related Posts

Comments

Comment from TearsofMandos
Time August 27, 2011 at 9:23 am

2:03 if its less or equal? with a single code line you can check if its equal and only continue if its less, no need to search any longer if it is equal, but still great tutorial

Comment from protosspc
Time August 27, 2011 at 9:30 am

The pseudo-code you provided does not work for finding the last element in the array. The simple fix for this is to add an else if statement after the if( A[low] == target ) statement checking for the value at A[high]. Here is the code you would add: else if ( A[high] == target ) { return high; }

Comment from ddopeski
Time August 27, 2011 at 10:21 am

Thanks. Extremely helpful.

Comment from Nick28th
Time August 27, 2011 at 11:20 am

you will also have to sort the binary array so that adds a lot of time well to the computer a lot of time.

Comment from ubermench42
Time August 27, 2011 at 11:59 am

Excellent video, very understandable.

Comment from locksndoors
Time August 27, 2011 at 12:02 pm

good job with the thorough explanation.

Comment from Edange
Time August 27, 2011 at 12:41 pm

Love your videos man. I got a programming test tomorrow u helped me alot! Cheers!

Comment from aashish387
Time August 27, 2011 at 12:45 pm

THNX :)

Comment from shakira20848
Time August 27, 2011 at 12:47 pm

there are many datig side for you naneedj.info

Comment from aawood
Time August 27, 2011 at 12:56 pm

@jelewis2 True, although if you’re in a situation where you’re going to be doing multiple searches on the dataset, it’s probably worth the time to sort it once so you can perform binary searches.

Comment from aawood
Time August 27, 2011 at 1:12 pm

@MrDavidVuong I thought that at first, but think about it; that means one more test at every single step, so a 50% increase in time at each step; you’re trading a potentially reduction in the number of steps, for an increase in the time each step takes. For more than a relatively tiny dataset, you’re better not performing the equals test.

Comment from MrDavidVuong
Time August 27, 2011 at 2:12 pm

wouldn’t it be faster if you first check of the integer is equal to middle rather than checking if it’s greater or less than first….. but yeah, awesome video man!

Comment from undo4peace
Time August 27, 2011 at 3:09 pm

danke! :D

Comment from lthindu
Time August 27, 2011 at 4:07 pm

i hate binary and linear search over any other algorithms

Comment from sinokayaako
Time August 27, 2011 at 4:54 pm

the best!

Comment from SergiuXxCracker
Time August 27, 2011 at 5:31 pm

really nice tutorial,but it will better if you will post an shortest path algorithm:P.

Comment from jelewis2
Time August 27, 2011 at 6:11 pm

It’s unfortunate that linear searches are sometimes needed, because the fastest known sorting algorithms are slower than O(n) in the average case, so sorting followed by a binary search is generally slower than a simple linear search.

Comment from psychofish25
Time August 27, 2011 at 6:57 pm

great video guys :) while your other topics might not hit me as hard, your algorithms videos are just great, really been looking for tutorials like these. so great job :)

Comment from OlloX3
Time August 27, 2011 at 7:47 pm

Awesome !

Comment from zamliman
Time August 27, 2011 at 8:34 pm

Thanks dude really good.

Write a comment