{"id":143,"date":"2024-11-10T19:06:28","date_gmt":"2024-11-10T19:06:28","guid":{"rendered":"https:\/\/akosgombkoto.info\/?page_id=143"},"modified":"2025-01-15T09:06:12","modified_gmt":"2025-01-15T09:06:12","slug":"quick-sort-algoritmus","status":"publish","type":"page","link":"https:\/\/akosgombkoto.info\/en\/quick-sort-algoritmus\/","title":{"rendered":"Quick Sort Algorithm"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; admin_label=&#8221;Header&#8221; _builder_version=&#8221;4.27.3&#8243; _module_preset=&#8221;default&#8221; custom_padding=&#8221;0px||0px||false|false&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_row column_structure=&#8221;1_2,1_2&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; custom_padding=&#8221;0px|||||&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;1_2&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_image src=&#8221;https:\/\/akosgombkoto.info\/wp-content\/uploads\/2025\/01\/data-science-070-2.png&#8221; title_text=&#8221;data-science-070-2&#8243; _builder_version=&#8221;4.27.4&#8243; _module_preset=&#8221;default&#8221; max_width_tablet=&#8221;500px&#8221; max_width_phone=&#8221;220px&#8221; max_width_last_edited=&#8221;off|tablet&#8221; max_height_tablet=&#8221;200px&#8221; max_height_phone=&#8221;100px&#8221; max_height_last_edited=&#8221;on|phone&#8221; custom_margin=&#8221;|||-8vw|false|false&#8221; custom_margin_tablet=&#8221;|||0vw|false|false&#8221; custom_margin_phone=&#8221;&#8221; custom_margin_last_edited=&#8221;on|tablet&#8221; hover_enabled=&#8221;0&#8243; global_colors_info=&#8221;{}&#8221; sticky_enabled=&#8221;0&#8243;][\/et_pb_image][\/et_pb_column][et_pb_column type=&#8221;1_2&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; custom_padding=&#8221;120px||||false|false&#8221; custom_padding_tablet=&#8221;0px||||false|false&#8221; custom_padding_phone=&#8221;&#8221; custom_padding_last_edited=&#8221;on|tablet&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_text _builder_version=&#8221;4.27.3&#8243; _module_preset=&#8221;d72c0383-6487-4f2c-ac5c-7d48a6376757&#8243; header_font=&#8221;Roboto Slab||||||||&#8221; header_text_color=&#8221;#000000&#8243; header_font_size=&#8221;52px&#8221; header_line_height=&#8221;1.2em&#8221; custom_margin=&#8221;||10px||false|false&#8221; header_font_size_tablet=&#8221;40px&#8221; header_font_size_phone=&#8221;20px&#8221; header_font_size_last_edited=&#8221;on|phone&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h1>Quick Sort Sorting Algorithm<\/h1>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/akosgombkoto.info\/wp-content\/uploads\/2024\/11\/02_quick_sort_Kepernyokep-2024-11-09-201432.png&#8221; title_text=&#8221;02_quick_sort_K\u00e9perny\u0151k\u00e9p 2024-11-09 201432&#8243; show_in_lightbox=&#8221;on&#8221; _builder_version=&#8221;4.27.3&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][\/et_pb_image][\/et_pb_column][\/et_pb_row][\/et_pb_section][et_pb_section fb_built=&#8221;1&#8243; admin_label=&#8221;Blog&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_row _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_text _builder_version=&#8221;4.27.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Roboto Mono||||||||&#8221; text_text_color=&#8221;#fcb03a&#8221; text_font_size=&#8221;18px&#8221; text_line_height=&#8221;1.8em&#8221; background_color=&#8221;#042f4f&#8221; custom_padding=&#8221;15px||15px|20px|true|false&#8221; hover_enabled=&#8221;0&#8243; global_colors_info=&#8221;{}&#8221; sticky_enabled=&#8221;0&#8243;]<\/p>\n<p>The Quick Sort algorithm is one of the most commonly used sorting algorithms.<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.27.3&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Roboto Mono||||||||&#8221; text_text_color=&#8221;#fcb03a&#8221; text_font_size=&#8221;18px&#8221; text_line_height=&#8221;1.8em&#8221; custom_padding=&#8221;15px||15px|20px|true|false&#8221; global_colors_info=&#8221;{}&#8221; background_color=&#8221;#042f4f&#8221;]<\/p>\n<p><strong>After running the code in Visual Studio, as shown in the command prompt at the bottom of the screen (recommended to view in full-screen mode), you can see that the list defined in the code is sorted in ascending order.<\/strong><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/akosgombkoto.info\/wp-content\/uploads\/2024\/11\/02_quick_sort_Kepernyokep-2024-11-09-201432.png&#8221; title_text=&#8221;02_quick_sort_K\u00e9perny\u0151k\u00e9p 2024-11-09 201432&#8243; _builder_version=&#8221;4.27.3&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][\/et_pb_image][et_pb_toggle title=&#8221;Quick Sort m\u0171k\u00f6d\u00e9si elv (leny\u00edl\u00f3 tartalom &#8211; kattints a jobb sz\u00e9ls\u0151 + ikonra)&#8221; open_toggle_text_color=&#8221;#fcb03a&#8221; open_toggle_background_color=&#8221;#042f4f&#8221; closed_toggle_text_color=&#8221;#fcb03a&#8221; closed_toggle_background_color=&#8221;#042f4f&#8221; icon_color=&#8221;#fcb03a&#8221; open_icon_color=&#8221;#fcb03a&#8221; _builder_version=&#8221;4.27.4&#8243; _module_preset=&#8221;default&#8221; title_font=&#8221;|700|||||||&#8221; title_font_size=&#8221;18px&#8221; closed_title_font_size=&#8221;18px&#8221; body_text_color=&#8221;#FFFFFF&#8221; body_font_size=&#8221;16px&#8221; body_line_height=&#8221;1.8em&#8221; hover_enabled=&#8221;0&#8243; global_colors_info=&#8221;{}&#8221; sticky_enabled=&#8221;0&#8243;]<\/p>\n<p style=\"text-align: justify;\">The Quick Sort algorithm is a divide-and-conquer sorting algorithm. Its operation involves the following steps:<\/p>\n<p style=\"text-align: justify;\" class=\"translation-block\">1. Selecting a Pivot\nThe first step in Quick Sort is choosing a pivot element. The pivot can be any element in the list, such as the first, last, or middle element. This pivot serves as the basis for sorting the other elements.<\/p>\n<p style=\"text-align: justify;\">Partitioning<br \/>A k\u00f6vetkez\u0151 l\u00e9p\u00e9sben az algoritmus a pivot elem k\u00f6r\u00e9 rendezi az elemeket:<\/p>\n<p style=\"text-align: justify;\" class=\"translation-block\">All elements smaller than the pivot are placed before it.\nAll elements larger than the pivot are placed after it.\nOnce this is done, the pivot is swapped into its correct position in the list.<\/p>\n<p style=\"text-align: justify;\">3. Recursive Sorting<br \/>After placing the pivot in its correct position, the algorithm recursively calls itself on the sublists to the left and right of the pivot (the pivot itself is not included, as it is already sorted).<\/p>\n<p style=\"text-align: justify;\" class=\"translation-block\">The process is repeated for both smaller and larger elements on the left and right sides.\nThe recursion continues until each sublist contains only one or no elements, at which point they are considered sorted.<\/p>\n<p style=\"text-align: justify;\">4. Completion<br \/>The recursion ends for all levels once all sublists are sorted. The algorithm finally returns a fully sorted list by combining the sorted sublists.<\/p>\n<p>[\/et_pb_toggle][et_pb_toggle title=&#8221;K\u00f3dmag: (leny\u00edl\u00f3 tartalom &#8211; kattints a jobb sz\u00e9ls\u0151 + ikonra)&#8221; open_toggle_text_color=&#8221;#fcb03a&#8221; open_toggle_background_color=&#8221;#042f4f&#8221; closed_toggle_text_color=&#8221;#fcb03a&#8221; closed_toggle_background_color=&#8221;#042f4f&#8221; icon_color=&#8221;#fcb03a&#8221; open_icon_color=&#8221;#fcb03a&#8221; _builder_version=&#8221;4.27.3&#8243; _module_preset=&#8221;default&#8221; title_font=&#8221;|700|||||||&#8221; title_font_size=&#8221;18px&#8221; closed_title_font_size=&#8221;18px&#8221; body_text_color=&#8221;#FFFFFF&#8221; body_font_size=&#8221;16px&#8221; body_line_height=&#8221;1.8em&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<pre class=\"aLF-aPX-K0-aPE\">def quick_sort(list):\n    if len(list) &lt;= 1:\n        return list\n    else:\n        pivot = list[len(list) \/\/ 2]\n        left = []\n        middle = []\n        right = []\n\n        for x in list:\n            if x &lt; pivot:\n                left.append(x)\n            elif x == pivot:\n                middle.append(x)\n            else:\n                right.append(x)\n\n        return quick_sort(left) + middle + quick_sort(right)\n\n# P\u00e9lda a haszn\u00e1latra\nlist = [10, 15, 4,21, 17,36, 2, 27, 45, 33, 29, 41, 9, 1, 5]\nsorted_list = quick_sort(list)\nprint(\"Rendezett lista:\", sorted_list)<\/pre>\n<p><code><\/code><\/p>\n<p>[\/et_pb_toggle][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>","protected":false},"excerpt":{"rendered":"<p>Quick sort rendez\u00e9si algoritmusA Quick Sort rendez\u00e9si algoritmus az egyik leggyakrabban haszn\u00e1lt listarendez\u0151 algoritmus.A Visual Studio-ban k\u00e9sz\u00edtett k\u00f3d lefut\u00e1sa ut\u00e1n l\u00e1thatjuk a k\u00e9pen alul a parancsmez\u0151ben, hogy a k\u00f3dban megadott list\u00e1t n\u00f6vekv\u0151 sorrendbe rendezi (teljes k\u00e9perny\u0151s n\u00e9z\u00e9s az aj\u00e1nlott).A Quick Sort algoritmus egy elv\u00e1laszt\u00e1sos rendez\u00e9si algoritmus, amely az &#8222;oszd meg \u00e9s uralkodj&#8221; (divide and conquer) [&hellip;]<\/p>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"class_list":["post-143","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/akosgombkoto.info\/en\/wp-json\/wp\/v2\/pages\/143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/akosgombkoto.info\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/akosgombkoto.info\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/akosgombkoto.info\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/akosgombkoto.info\/en\/wp-json\/wp\/v2\/comments?post=143"}],"version-history":[{"count":26,"href":"https:\/\/akosgombkoto.info\/en\/wp-json\/wp\/v2\/pages\/143\/revisions"}],"predecessor-version":[{"id":686,"href":"https:\/\/akosgombkoto.info\/en\/wp-json\/wp\/v2\/pages\/143\/revisions\/686"}],"wp:attachment":[{"href":"https:\/\/akosgombkoto.info\/en\/wp-json\/wp\/v2\/media?parent=143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}