2012- 5- 16
|
#3
|
|
أكـاديـمـي فـعّـال
|
رد: ^^^^محاضرة searching algorithms 11 وش المهم اللي فيها ^^^^
>> طيب اشرحوا لي النقاط هذي ::
فكرة عمل الخوارزم ::
كود:
Algorithm
Algorithm is quite simple. It can be done either recursively or iteratively:
1. get the middle element;
2. if the middle element equals to the searched value, the algorithm stops;
3. otherwise, two cases are possible:
o searched value is less, than the middle element. In this case, go to the step 1 for the part of the array, before middle element.
o searched value is greater, than the middle element. In this case, go to the step 1 for the part of the array, after middle element.
|
|
التعديل الأخير تم بواسطة bassmah ; 2012- 5- 16 الساعة 11:35 AM
|
|
|
|