{"id":1504,"date":"2025-09-28T11:18:43","date_gmt":"2025-09-28T04:18:43","guid":{"rendered":"https:\/\/kienthucmo.com\/?p=1504"},"modified":"2025-11-05T23:36:09","modified_gmt":"2025-11-05T16:36:09","slug":"tim-kiem-phan-tu-trong-array-voi-python","status":"publish","type":"post","link":"https:\/\/kienthucmo.com\/vi\/tim-kiem-phan-tu-trong-array-voi-python\/","title":{"rendered":"T\u00ecm ki\u1ebfm ph\u1ea7n t\u1eed trong Array v\u1edbi Python"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Trong qu\u00e1 tr\u00ecnh l\u1eadp tr\u00ecnh, vi\u1ec7c l\u00e0m vi\u1ec7c v\u1edbi <strong>array<\/strong> (m\u1ea3ng) l\u00e0 m\u1ed9t thao t\u00e1c c\u01a1 b\u1ea3n v\u00e0 quen thu\u1ed9c. M\u1ed9t trong nh\u1eefng nhu c\u1ea7u th\u01b0\u1eddng xuy\u00ean nh\u1ea5t ch\u00ednh l\u00e0 <strong>t\u00ecm ki\u1ebfm ph\u1ea7n t\u1eed<\/strong>. B\u1ea5t k\u1ec3 b\u1ea1n \u0111ang x\u00e2y d\u1ef1ng m\u1ed9t ch\u01b0\u01a1ng tr\u00ecnh nh\u1ecf hay m\u1ed9t h\u1ec7 th\u1ed1ng l\u1edbn, kh\u1ea3 n\u0103ng t\u00ecm nhanh v\u1ecb tr\u00ed ho\u1eb7c gi\u00e1 tr\u1ecb trong array gi\u00fap ti\u1ebft ki\u1ec7m r\u1ea5t nhi\u1ec1u th\u1eddi gian v\u00e0 c\u00f4ng s\u1ee9c.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Trong Python, array kh\u00f4ng ph\u1ed5 bi\u1ebfn b\u1eb1ng <strong>list<\/strong>, nh\u01b0ng ch\u00fang v\u1eabn \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng trong nhi\u1ec1u t\u00ecnh hu\u1ed1ng c\u1ea7n qu\u1ea3n l\u00fd d\u1eef li\u1ec7u s\u1ed1 v\u1edbi dung l\u01b0\u1ee3ng l\u1edbn v\u00e0 ti\u1ebft ki\u1ec7m b\u1ed9 nh\u1edb. Ch\u00ednh v\u00ec v\u1eady, vi\u1ec7c hi\u1ec3u v\u00e0 th\u00e0nh th\u1ea1o c\u00e1c c\u00e1ch <strong>t\u00ecm ki\u1ebfm ph\u1ea7n t\u1eed trong array Python<\/strong> l\u00e0 r\u1ea5t c\u1ea7n thi\u1ebft.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Trong b\u00e0i vi\u1ebft n\u00e0y, m\u00ecnh s\u1ebd chia s\u1ebb m\u1ed9t c\u00e1ch c\u00f3 h\u1ec7 th\u1ed1ng v\u1ec1 c\u00e1c ph\u01b0\u01a1ng ph\u00e1p t\u00ecm ki\u1ebfm trong array, \u0111i k\u00e8m v\u00ed d\u1ee5 minh h\u1ecda chi ti\u1ebft.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. T\u1ed5ng quan v\u1ec1 array trong Python<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Tr\u01b0\u1edbc khi \u0111i s\u00e2u v\u00e0o t\u00ecm ki\u1ebfm, ch\u00fang ta c\u1ea7n n\u1eafm r\u00f5 m\u1ed9t s\u1ed1 \u0111i\u1ec3m quan tr\u1ecdng v\u1ec1 array trong Python:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Array trong Python \u0111\u01b0\u1ee3c h\u1ed7 tr\u1ee3 b\u1edfi <strong>module <code>array<\/code><\/strong>, kh\u00e1c v\u1edbi <strong>list<\/strong> v\u1ed1n l\u00e0 ki\u1ec3u d\u1eef li\u1ec7u t\u00edch h\u1ee3p s\u1eb5n.<\/li>\n\n\n\n<li>Array ch\u1ec9 ch\u1ee9a <strong>c\u00e1c ph\u1ea7n t\u1eed c\u00f9ng ki\u1ec3u d\u1eef li\u1ec7u<\/strong> (v\u00ed d\u1ee5: to\u00e0n b\u1ed9 l\u00e0 s\u1ed1 nguy\u00ean ho\u1eb7c to\u00e0n b\u1ed9 l\u00e0 s\u1ed1 th\u1ef1c).<\/li>\n\n\n\n<li>C\u00fa ph\u00e1p kh\u1edfi t\u1ea1o:<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>import array\n\n# Create an integer array\narr = array.array(\"i\", &#91;10, 20, 30, 40, 50&#93;)\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> array<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Create an integer array<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">arr <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> array<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">array<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">i<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #B48EAD\">10<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">20<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">30<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">40<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">50<\/span><span style=\"color: #ECEFF4\">&#93;)<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Trong \u0111\u00f3:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>\"i\"<\/code> l\u00e0 type code (\u0111\u1ea1i di\u1ec7n cho integer \u2013 s\u1ed1 nguy\u00ean).<\/li>\n\n\n\n<li><code>[10, 20, 30, 40, 50]<\/code> l\u00e0 danh s\u00e1ch kh\u1edfi t\u1ea1o gi\u00e1 tr\u1ecb ban \u0111\u1ea7u.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">V\u1edbi n\u1ec1n t\u1ea3ng n\u00e0y, ta s\u1ebd tri\u1ec3n khai c\u00e1c c\u00e1ch <strong>t\u00ecm ki\u1ebfm ph\u1ea7n t\u1eed trong array<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. T\u00ecm ki\u1ebfm tuy\u1ebfn t\u00ednh (Linear Search)<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">2.1 Kh\u00e1i ni\u1ec7m<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Linear Search l\u00e0 ph\u01b0\u01a1ng ph\u00e1p t\u00ecm ki\u1ebfm \u0111\u01a1n gi\u1ea3n nh\u1ea5t. \u00dd t\u01b0\u1edfng c\u1ee7a n\u00f3 l\u00e0 duy\u1ec7t qua t\u1eebng ph\u1ea7n t\u1eed trong array t\u1eeb \u0111\u1ea7u \u0111\u1ebfn cu\u1ed1i, so s\u00e1nh v\u1edbi gi\u00e1 tr\u1ecb c\u1ea7n t\u00ecm, v\u00e0 d\u1eebng l\u1ea1i khi t\u00ecm th\u1ea5y.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2.2 V\u00ed d\u1ee5 minh h\u1ecda<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>import array\n\n# Create an integer array\narr = array.array(\"i\", &#91;10, 20, 30, 40, 50&#93;)\n\n# Value to search\ntarget = 30\n\n# Linear search implementation\nfor index, value in enumerate(arr):\n    if value == target:\n        print(f\"Element {target} found at index {index}\")\n        break\nelse:\n    print(f\"Element {target} not found\")\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> array<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Create an integer array<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">arr <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> array<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">array<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">i<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #B48EAD\">10<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">20<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">30<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">40<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">50<\/span><span style=\"color: #ECEFF4\">&#93;)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Value to search<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">target <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">30<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Linear search implementation<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">for<\/span><span style=\"color: #D8DEE9FF\"> index<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> value <\/span><span style=\"color: #81A1C1\">in<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">enumerate<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">arr<\/span><span style=\"color: #ECEFF4\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> value <\/span><span style=\"color: #81A1C1\">==<\/span><span style=\"color: #D8DEE9FF\"> target<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #81A1C1\">f<\/span><span style=\"color: #A3BE8C\">&quot;Element <\/span><span style=\"color: #EBCB8B\">{<\/span><span style=\"color: #D8DEE9FF\">target<\/span><span style=\"color: #EBCB8B\">}<\/span><span style=\"color: #A3BE8C\"> found at index <\/span><span style=\"color: #EBCB8B\">{<\/span><span style=\"color: #D8DEE9FF\">index<\/span><span style=\"color: #EBCB8B\">}<\/span><span style=\"color: #A3BE8C\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">break<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">else<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #81A1C1\">f<\/span><span style=\"color: #A3BE8C\">&quot;Element <\/span><span style=\"color: #EBCB8B\">{<\/span><span style=\"color: #D8DEE9FF\">target<\/span><span style=\"color: #EBCB8B\">}<\/span><span style=\"color: #A3BE8C\"> not found&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">2.3 Ph\u00e2n t\u00edch<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Tr\u01b0\u1eddng h\u1ee3p t\u1ed1t nh\u1ea5t: ph\u1ea7n t\u1eed n\u1eb1m \u1edf \u0111\u1ea7u array \u2192 O(1).<\/li>\n\n\n\n<li>Tr\u01b0\u1eddng h\u1ee3p x\u1ea5u nh\u1ea5t: ph\u1ea7n t\u1eed n\u1eb1m \u1edf cu\u1ed1i ho\u1eb7c kh\u00f4ng t\u1ed3n t\u1ea1i \u2192 O(n).<\/li>\n\n\n\n<li>Linear Search ph\u00f9 h\u1ee3p v\u1edbi m\u1ea3ng nh\u1ecf ho\u1eb7c kh\u00f4ng \u0111\u01b0\u1ee3c s\u1eafp x\u1ebfp.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">3. T\u00ecm ki\u1ebfm nh\u1ecb ph\u00e2n (Binary Search)<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">3.1 Kh\u00e1i ni\u1ec7m<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Binary Search hi\u1ec7u qu\u1ea3 h\u01a1n nhi\u1ec1u so v\u1edbi Linear Search, nh\u01b0ng y\u00eau c\u1ea7u <strong>array ph\u1ea3i \u0111\u01b0\u1ee3c s\u1eafp x\u1ebfp tr\u01b0\u1edbc<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thu\u1eadt to\u00e1n chia array l\u00e0m \u0111\u00f4i, so s\u00e1nh ph\u1ea7n t\u1eed gi\u1eefa v\u1edbi gi\u00e1 tr\u1ecb c\u1ea7n t\u00ecm, r\u1ed3i ti\u1ebfp t\u1ee5c thu h\u1eb9p ph\u1ea1m vi t\u00ecm ki\u1ebfm xu\u1ed1ng m\u1ed9t n\u1eeda.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3.2 V\u00ed d\u1ee5 minh h\u1ecda<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>import array\n\n# Create a sorted integer array\narr = array.array(\"i\", &#91;10, 20, 30, 40, 50, 60, 70&#93;)\n\n# Value to search\ntarget = 50\n\n# Binary search implementation\nlow = 0\nhigh = len(arr) - 1\nfound = False\n\nwhile low &lt;= high:\n    mid = (low + high) \/\/ 2\n    if arr&#91;mid&#93; == target:\n        print(f\"Element {target} found at index {mid}\")\n        found = True\n        break\n    elif arr&#91;mid&#93; &lt; target:\n        low = mid + 1\n    else:\n        high = mid - 1\n\nif not found:\n    print(f\"Element {target} not found\")\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> array<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Create a sorted integer array<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">arr <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> array<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">array<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">i<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #B48EAD\">10<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">20<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">30<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">40<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">50<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">60<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">70<\/span><span style=\"color: #ECEFF4\">&#93;)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Value to search<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">target <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">50<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Binary search implementation<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">low <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">0<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">high <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">len<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">arr<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">found <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">False<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">while<\/span><span style=\"color: #D8DEE9FF\"> low <\/span><span style=\"color: #81A1C1\">&lt;=<\/span><span style=\"color: #D8DEE9FF\"> high<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    mid <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">low <\/span><span style=\"color: #81A1C1\">+<\/span><span style=\"color: #D8DEE9FF\"> high<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">\/\/<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">2<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> arr<\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #D8DEE9FF\">mid<\/span><span style=\"color: #ECEFF4\">&#93;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">==<\/span><span style=\"color: #D8DEE9FF\"> target<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #81A1C1\">f<\/span><span style=\"color: #A3BE8C\">&quot;Element <\/span><span style=\"color: #EBCB8B\">{<\/span><span style=\"color: #D8DEE9FF\">target<\/span><span style=\"color: #EBCB8B\">}<\/span><span style=\"color: #A3BE8C\"> found at index <\/span><span style=\"color: #EBCB8B\">{<\/span><span style=\"color: #D8DEE9FF\">mid<\/span><span style=\"color: #EBCB8B\">}<\/span><span style=\"color: #A3BE8C\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        found <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">True<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">break<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">elif<\/span><span style=\"color: #D8DEE9FF\"> arr<\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #D8DEE9FF\">mid<\/span><span style=\"color: #ECEFF4\">&#93;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">&lt;<\/span><span style=\"color: #D8DEE9FF\"> target<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        low <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> mid <\/span><span style=\"color: #81A1C1\">+<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">else<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        high <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> mid <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">not<\/span><span style=\"color: #D8DEE9FF\"> found<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #81A1C1\">f<\/span><span style=\"color: #A3BE8C\">&quot;Element <\/span><span style=\"color: #EBCB8B\">{<\/span><span style=\"color: #D8DEE9FF\">target<\/span><span style=\"color: #EBCB8B\">}<\/span><span style=\"color: #A3BE8C\"> not found&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">3.3 Ph\u00e2n t\u00edch<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0110\u1ed9 ph\u1ee9c t\u1ea1p: O(log n).<\/li>\n\n\n\n<li>Hi\u1ec7u qu\u1ea3 v\u1edbi m\u1ea3ng l\u1edbn \u0111\u00e3 s\u1eafp x\u1ebfp.<\/li>\n\n\n\n<li>N\u1ebfu array kh\u00f4ng s\u1eafp x\u1ebfp, c\u1ea7n <strong>sort<\/strong> tr\u01b0\u1edbc, nh\u01b0ng chi ph\u00ed s\u1eafp x\u1ebfp c\u00f3 th\u1ec3 l\u00e0m gi\u1ea3m hi\u1ec7u qu\u1ea3.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">4. S\u1eed d\u1ee5ng th\u01b0 vi\u1ec7n <code>bisect<\/code> trong Python<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">4.1 Gi\u1edbi thi\u1ec7u<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Python cung c\u1ea5p module <strong><code>bisect<\/code><\/strong>, gi\u00fap c\u00e0i \u0111\u1eb7t Binary Search nhanh ch\u00f3ng m\u00e0 kh\u00f4ng c\u1ea7n vi\u1ebft thu\u1eadt to\u00e1n th\u1ee7 c\u00f4ng.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4.2 V\u00ed d\u1ee5 minh h\u1ecda<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>import array\nimport bisect\n\n# Create a sorted integer array\narr = array.array(\"i\", &#91;10, 20, 30, 40, 50, 60&#93;)\n\n# Value to search\ntarget = 40\n\n# Use bisect_left to find insertion index\nindex = bisect.bisect_left(arr, target)\n\nif index &lt; len(arr) and arr&#91;index&#93; == target:\n    print(f\"Element {target} found at index {index}\")\nelse:\n    print(f\"Element {target} not found\")\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> array<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> bisect<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Create a sorted integer array<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">arr <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> array<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">array<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">i<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #B48EAD\">10<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">20<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">30<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">40<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">50<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">60<\/span><span style=\"color: #ECEFF4\">&#93;)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Value to search<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">target <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">40<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Use bisect_left to find insertion index<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">index <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> bisect<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">bisect_left<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">arr<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> target<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> index <\/span><span style=\"color: #81A1C1\">&lt;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">len<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">arr<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">and<\/span><span style=\"color: #D8DEE9FF\"> arr<\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #D8DEE9FF\">index<\/span><span style=\"color: #ECEFF4\">&#93;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">==<\/span><span style=\"color: #D8DEE9FF\"> target<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #81A1C1\">f<\/span><span style=\"color: #A3BE8C\">&quot;Element <\/span><span style=\"color: #EBCB8B\">{<\/span><span style=\"color: #D8DEE9FF\">target<\/span><span style=\"color: #EBCB8B\">}<\/span><span style=\"color: #A3BE8C\"> found at index <\/span><span style=\"color: #EBCB8B\">{<\/span><span style=\"color: #D8DEE9FF\">index<\/span><span style=\"color: #EBCB8B\">}<\/span><span style=\"color: #A3BE8C\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">else<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #81A1C1\">f<\/span><span style=\"color: #A3BE8C\">&quot;Element <\/span><span style=\"color: #EBCB8B\">{<\/span><span style=\"color: #D8DEE9FF\">target<\/span><span style=\"color: #EBCB8B\">}<\/span><span style=\"color: #A3BE8C\"> not found&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">4.3 \u01afu \u0111i\u1ec3m<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>T\u00edch h\u1ee3p s\u1eb5n, d\u1ec5 s\u1eed d\u1ee5ng.<\/li>\n\n\n\n<li>T\u1ed1i \u01b0u cho c\u00e1c thao t\u00e1c v\u1eeba t\u00ecm ki\u1ebfm v\u1eeba ch\u00e8n v\u00e0o array \u0111\u00e3 s\u1eafp x\u1ebfp.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">5. T\u00ecm ki\u1ebfm v\u1edbi \u0111i\u1ec1u ki\u1ec7n t\u00f9y ch\u1ec9nh<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Kh\u00f4ng ph\u1ea3i l\u00fac n\u00e0o ta c\u0169ng t\u00ecm ki\u1ebfm tr\u1ef1c ti\u1ebfp m\u1ed9t gi\u00e1 tr\u1ecb. \u0110\u00f4i khi, ta c\u1ea7n <strong>t\u00ecm ph\u1ea7n t\u1eed theo \u0111i\u1ec1u ki\u1ec7n<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5.1 V\u00ed d\u1ee5: t\u00ecm s\u1ed1 ch\u1eb5n \u0111\u1ea7u ti\u00ean<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>import array\n\n# Create an integer array\narr = array.array(\"i\", &#91;11, 15, 18, 21, 30&#93;)\n\n# Find first even number\nfor index, value in enumerate(arr):\n    if value % 2 == 0:\n        print(f\"First even number is {value} at index {index}\")\n        break\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> array<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Create an integer array<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">arr <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> array<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">array<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">i<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #B48EAD\">11<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">15<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">18<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">21<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">30<\/span><span style=\"color: #ECEFF4\">&#93;)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Find first even number<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">for<\/span><span style=\"color: #D8DEE9FF\"> index<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> value <\/span><span style=\"color: #81A1C1\">in<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">enumerate<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">arr<\/span><span style=\"color: #ECEFF4\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> value <\/span><span style=\"color: #81A1C1\">%<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">2<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">==<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">0<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #81A1C1\">f<\/span><span style=\"color: #A3BE8C\">&quot;First even number is <\/span><span style=\"color: #EBCB8B\">{<\/span><span style=\"color: #D8DEE9FF\">value<\/span><span style=\"color: #EBCB8B\">}<\/span><span style=\"color: #A3BE8C\"> at index <\/span><span style=\"color: #EBCB8B\">{<\/span><span style=\"color: #D8DEE9FF\">index<\/span><span style=\"color: #EBCB8B\">}<\/span><span style=\"color: #A3BE8C\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">break<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">5.2 V\u00ed d\u1ee5: t\u00ecm t\u1ea5t c\u1ea3 ph\u1ea7n t\u1eed l\u1edbn h\u01a1n m\u1ed9t gi\u00e1 tr\u1ecb<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>import array\n\n# Create an integer array\narr = array.array(\"i\", &#91;5, 12, 18, 7, 30, 2&#93;)\n\n# Find all numbers greater than 10\ngreater_than_10 = &#91;value for value in arr if value > 10&#93;\n\nprint(\"Elements greater than 10:\", greater_than_10)\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> array<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Create an integer array<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">arr <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> array<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">array<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">i<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #B48EAD\">5<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">12<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">18<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">7<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">30<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">2<\/span><span style=\"color: #ECEFF4\">&#93;)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Find all numbers greater than 10<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">greater_than_10 <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #D8DEE9FF\">value <\/span><span style=\"color: #81A1C1\">for<\/span><span style=\"color: #D8DEE9FF\"> value <\/span><span style=\"color: #81A1C1\">in<\/span><span style=\"color: #D8DEE9FF\"> arr <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> value <\/span><span style=\"color: #81A1C1\">&gt;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">10<\/span><span style=\"color: #ECEFF4\">&#93;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">Elements greater than 10:<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> greater_than_10<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Vi\u1ec7c t\u00ecm ki\u1ebfm theo \u0111i\u1ec1u ki\u1ec7n gi\u00fap array tr\u1edf n\u00ean linh ho\u1ea1t h\u01a1n trong c\u00e1c \u1ee9ng d\u1ee5ng th\u1ef1c t\u1ebf.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6. So s\u00e1nh c\u00e1c ph\u01b0\u01a1ng ph\u00e1p t\u00ecm ki\u1ebfm<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Ph\u01b0\u01a1ng ph\u00e1p<\/th><th>Y\u00eau c\u1ea7u s\u1eafp x\u1ebfp<\/th><th>\u0110\u1ed9 ph\u1ee9c t\u1ea1p<\/th><th>T\u00ecnh hu\u1ed1ng ph\u00f9 h\u1ee3p<\/th><\/tr><\/thead><tbody><tr><td>Linear Search<\/td><td>Kh\u00f4ng<\/td><td>O(n)<\/td><td>Array nh\u1ecf, ch\u01b0a s\u1eafp x\u1ebfp<\/td><\/tr><tr><td>Binary Search<\/td><td>C\u00f3<\/td><td>O(log n)<\/td><td>Array l\u1edbn, \u0111\u00e3 s\u1eafp x\u1ebfp<\/td><\/tr><tr><td>Bisect<\/td><td>C\u00f3<\/td><td>O(log n)<\/td><td>Khi v\u1eeba t\u00ecm ki\u1ebfm v\u1eeba ch\u00e8n<\/td><\/tr><tr><td>\u0110i\u1ec1u ki\u1ec7n t\u00f9y ch\u1ec9nh<\/td><td>Kh\u00f4ng<\/td><td>T\u00f9y bi\u1ebfn<\/td><td>B\u00e0i to\u00e1n \u0111\u1eb7c th\u00f9<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">7. \u1ee8ng d\u1ee5ng th\u1ef1c t\u1ebf<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Vi\u1ec7c t\u00ecm ki\u1ebfm ph\u1ea7n t\u1eed trong array xu\u1ea5t hi\u1ec7n \u1edf nhi\u1ec1u t\u00ecnh hu\u1ed1ng th\u1ef1c t\u1ebf:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Qu\u1ea3n l\u00fd d\u1eef li\u1ec7u s\u1ed1 l\u1edbn nh\u01b0 \u0111i\u1ec3m s\u1ed1, gi\u00e1 tr\u1ecb c\u1ea3m bi\u1ebfn.<\/li>\n\n\n\n<li>H\u1ec7 th\u1ed1ng x\u1eed l\u00fd t\u00edn hi\u1ec7u, n\u01a1i d\u1eef li\u1ec7u c\u1ea7n t\u00ecm nhanh trong lu\u1ed3ng li\u00ean t\u1ee5c.<\/li>\n\n\n\n<li>C\u00e1c thu\u1eadt to\u00e1n ph\u00e2n t\u00edch, nh\u01b0 t\u00ecm ph\u1ea7n t\u1eed l\u1edbn h\u01a1n ng\u01b0\u1ee1ng.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">V\u00ed d\u1ee5: Trong m\u1ed9t \u1ee9ng d\u1ee5ng IoT, d\u1eef li\u1ec7u nhi\u1ec7t \u0111\u1ed9 t\u1eeb c\u1ea3m bi\u1ebfn c\u00f3 th\u1ec3 l\u01b0u trong array. Vi\u1ec7c t\u00ecm ki\u1ebfm gi\u00e1 tr\u1ecb v\u01b0\u1ee3t ng\u01b0\u1ee1ng c\u1ea3nh b\u00e1o gi\u00fap h\u1ec7 th\u1ed1ng k\u1ecbp th\u1eddi x\u1eed l\u00fd.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">8. K\u1ebft lu\u1eadn<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Trong Python, vi\u1ec7c <strong>t\u00ecm ki\u1ebfm ph\u1ea7n t\u1eed trong array<\/strong> c\u00f3 th\u1ec3 th\u1ef1c hi\u1ec7n theo nhi\u1ec1u c\u00e1ch: Linear Search, Binary Search, d\u00f9ng th\u01b0 vi\u1ec7n <code>bisect<\/code>, ho\u1eb7c theo \u0111i\u1ec1u ki\u1ec7n t\u00f9y ch\u1ec9nh. M\u1ed7i ph\u01b0\u01a1ng ph\u00e1p c\u00f3 \u01b0u \u2013 nh\u01b0\u1ee3c \u0111i\u1ec3m ri\u00eang, v\u00e0 l\u1ef1a ch\u1ecdn ph\u00f9 h\u1ee3p t\u00f9y thu\u1ed9c v\u00e0o d\u1eef li\u1ec7u \u0111\u1ea7u v\u00e0o c\u0169ng nh\u01b0 y\u00eau c\u1ea7u c\u1ee7a b\u00e0i to\u00e1n.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">M\u00ecnh hy v\u1ecdng qua b\u00e0i vi\u1ebft n\u00e0y, b\u1ea1n c\u00f3 th\u1ec3 n\u1eafm ch\u1eafc v\u00e0 v\u1eadn d\u1ee5ng hi\u1ec7u qu\u1ea3 c\u00e1c k\u1ef9 thu\u1eadt t\u00ecm ki\u1ebfm trong array Python \u0111\u1ec3 t\u1ed1i \u01b0u ch\u01b0\u01a1ng tr\u00ecnh c\u1ee7a m\u00ecnh.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">9. T\u00e0i li\u1ec7u tham kh\u1ea3o<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Python Software Foundation. <em>array \u2014 Efficient arrays of numeric values<\/em>. Python Documentation. Truy c\u1eadp t\u1ea1i: <a>https:\/\/docs.python.org\/3\/library\/array.html<\/a><\/li>\n\n\n\n<li>Python Software Foundation. <em>bisect \u2014 Array bisection algorithm<\/em>. Python Documentation. Truy c\u1eadp t\u1ea1i: <a>https:\/\/docs.python.org\/3\/library\/bisect.html<\/a><\/li>\n\n\n\n<li>Cormen, T. H., Leiserson, C. E., Rivest, R. L., &amp; Stein, C. (2009). <em>Introduction to Algorithms<\/em> (3rd ed.). MIT Press.<\/li>\n\n\n\n<li>Python for Professionals: Learning Python as a Second Language: <a href=\"https:\/\/click.linksynergy.com\/link?id=*C\/UgjGtUZ8&amp;offerid=1562891.3721710002222624882405978&amp;type=15&amp;murl=https%3A%2F%2Fwww.kobo.com%2Fus%2Fen%2Febook%2Fpython-for-professionals-3\" target=\"_blank\" rel=\"noopener\">https:\/\/www.kobo.com\/us\/en\/ebook\/python-for-professionals-3<\/a><\/li>\n\n\n\n<li>Python: Deeper Insights into Machine Learning: <a href=\"https:\/\/click.linksynergy.com\/link?id=*C\/UgjGtUZ8&amp;offerid=1562891.3721710015810095319857183&amp;type=15&amp;murl=https%3A%2F%2Fwww.kobo.com%2Fus%2Fen%2Febook%2Fpython-deeper-insights-into-machine-learning\" target=\"_blank\" rel=\"noopener\">https:\/\/www.kobo.com\/us\/en\/ebook\/python-deeper-insights-into-machine-learning<\/a><\/li>\n\n\n\n<li>DataFusion Python Bindings in Practice: The Complete Guide for Developers and Engineers: <a href=\"https:\/\/click.linksynergy.com\/link?id=*C\/UgjGtUZ8&amp;offerid=1562891.3721710049093362364820452&amp;type=15&amp;murl=https%3A%2F%2Fwww.kobo.com%2Fus%2Fen%2Febook%2Fdatafusion-python-bindings-in-practice\" target=\"_blank\" rel=\"noopener\">https:\/\/www.kobo.com\/us\/en\/ebook\/datafusion-python-bindings-in-practice<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Trong qu\u00e1 tr\u00ecnh l\u1eadp tr\u00ecnh, vi\u1ec7c l\u00e0m vi\u1ec7c v\u1edbi array (m\u1ea3ng) l\u00e0 m\u1ed9t thao t\u00e1c c\u01a1 b\u1ea3n v\u00e0 quen thu\u1ed9c. M\u1ed9t trong nh\u1eefng nhu c\u1ea7u th\u01b0\u1eddng xuy\u00ean nh\u1ea5t ch\u00ednh l\u00e0 t\u00ecm ki\u1ebfm ph\u1ea7n t\u1eed. B\u1ea5t k\u1ec3 b\u1ea1n \u0111ang x\u00e2y d\u1ef1ng m\u1ed9t ch\u01b0\u01a1ng tr\u00ecnh nh\u1ecf hay m\u1ed9t h\u1ec7 th\u1ed1ng l\u1edbn, kh\u1ea3 n\u0103ng t\u00ecm nhanh v\u1ecb tr\u00ed ho\u1eb7c gi\u00e1 tr\u1ecb trong array gi\u00fap ti\u1ebft ki\u1ec7m r\u1ea5t nhi\u1ec1u th\u1eddi gian v\u00e0 c\u00f4ng s\u1ee9c.<\/p>\n","protected":false},"author":1,"featured_media":1700,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"googlesitekit_rrm_CAowieHDDA:productID":"","footnotes":""},"categories":[41],"tags":[40],"class_list":["post-1504","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kien-thuc-lap-trinh","tag-python-co-ban"],"_links":{"self":[{"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/posts\/1504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/comments?post=1504"}],"version-history":[{"count":3,"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/posts\/1504\/revisions"}],"predecessor-version":[{"id":2444,"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/posts\/1504\/revisions\/2444"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/media\/1700"}],"wp:attachment":[{"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/media?parent=1504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/categories?post=1504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/tags?post=1504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}