Skip to content

Commit 3267556

Browse files
committed
underline eytzinger search example
1 parent 19bb630 commit 3267556

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

content/english/hpc/data-structures/binary-search.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,15 +343,25 @@ while (k <= n)
343343

344344
The only problem arises when we need to restore the index of the resulting element, as $k$ does not directly point to it. Consider this example (its corresponding tree is listed above):
345345

346-
```center
346+
<!--
347347
array: 0 1 2 3 4 5 6 7 8 9
348348
eytzinger: 6 3 7 1 5 8 9 0 2 4
349349
1st range: ------------------- k := 1
350350
2nd range: ------------- k := 2*k = 2 (6 ≥ 3)
351351
3rd range: ------- k := 2*k = 4 (3 ≥ 3)
352352
4th range: --- k := 2*k + 1 = 9 (1 < 3)
353353
5th range: - k := 2*k + 1 = 19 (2 < 3)
354-
```
354+
-->
355+
356+
<pre class='center-pre'>
357+
array: 0 1 2 3 4 5 6 7 8 9
358+
eytzinger: <u>6</u> <u>3</u> 7 <u>1</u> 5 8 9 0 <u>2</u> 4
359+
1st range: ------------------- k := 1
360+
2nd range: ------------- k := 2*k = 2 (6 ≥ 3)
361+
3rd range: ------- k := 2*k = 4 (3 ≥ 3)
362+
4th range: --- k := 2*k + 1 = 9 (1 < 3)
363+
5th range: - k := 2*k + 1 = 19 (2 < 3)
364+
</pre>
355365

356366
<!-- do we need the last comparison? -->
357367

0 commit comments

Comments
 (0)