{"id":4140,"date":"2023-08-29T08:28:54","date_gmt":"2023-08-29T02:58:54","guid":{"rendered":"https:\/\/cbsepython.in\/?p=4140"},"modified":"2023-08-29T08:28:54","modified_gmt":"2023-08-29T02:58:54","slug":"searching-and-sorting-techniques-notes","status":"publish","type":"post","link":"https:\/\/cbsepython.in\/searching-and-sorting-techniques-notes\/","title":{"rendered":"Data Structure- Searching and Sorting Techniques Notes Class 12"},"content":{"rendered":"<h2><span style=\"color: #000000;\">Searching and Sorting Techniques Notes<\/span><\/h2>\n<p><span style=\"color: #000000;\"><strong>Sorting <\/strong><\/span><\/p>\n<p><span style=\"color: #000000;\">Sorting means to arrange the data either in ascending order or descending order. It is the process of rearranging a sequence of objects so as to put them in some logical order.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #000000;\"><strong>Selection Sort :\u00a0 <\/strong>Find the minimum element in unsorted array and swap it with the element in the begining\u00a0 of the sorted array.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #000000;\"><strong>Advantages of selection sort <\/strong><\/span><\/p>\n<ol>\n<li><span style=\"color: #000000;\">Selection sort algorithm is 60% more efficient than bubble sort algorithm.<\/span><\/li>\n<li><span style=\"color: #000000;\">Selection sort algorithm is easy to implement.<\/span><\/li>\n<li><span style=\"color: #000000;\">Selection sort algorithm can be used for small data sets, unfortunately Insertion sort algorithm best suitable for it.<\/span><\/li>\n<\/ol>\n<p><span style=\"color: #000000;\"><strong>Disadvantages of selection sort <\/strong><\/span><\/p>\n<ol>\n<li><span style=\"color: #000000;\">Insertion sort algorithm is far better than selection sort algorithm.<\/span><\/li>\n<li><span style=\"color: #000000;\">Runtime of selection sort is algorithum is very poor<\/span><\/li>\n<\/ol>\n<p><span style=\"color: #000000;\"><strong>Bubble Sort : <\/strong>Bubble sort is a simple sorting algorithum. This sorting algorithum is compaison based algorithum is which each pair of adjacmt elements is compared and element are swapped if they\u00a0 are not in order.<\/span><\/p>\n<ul>\n<li><span style=\"color: #000000;\">Compare two adjoining values and exchange them, if they are not in proper order.<\/span><\/li>\n<li><span style=\"color: #000000;\">After pass1, the largest element of the list will be at bottom.<\/span><\/li>\n<li><span style=\"color: #000000;\">If we have array of n elements ,we have to do n-1 iterations before we get our sorted array<\/span><\/li>\n<\/ul>\n<p><span style=\"color: #000000;\"><strong>Advantages of Bubble sort\u00a0\u00a0\u00a0 <\/strong><\/span><\/p>\n<ol>\n<li><span style=\"color: #000000;\">Bubble sort is one of the easiest sort algorithum<\/span><\/li>\n<li><span style=\"color: #000000;\">It is easy to implement<\/span><\/li>\n<li><span style=\"color: #000000;\">Elements are swapped in place, no use of extra array<\/span><\/li>\n<\/ol>\n<p><span style=\"color: #000000;\"><strong>Disadvantages of Bubble Sort <\/strong><\/span><\/p>\n<ol>\n<li><span style=\"color: #000000;\">Bubble sort algorithum is not suitable for large data sets<\/span><\/li>\n<li><span style=\"color: #000000;\">The code become complex for larger number of data<\/span><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #000000;\"><strong>Insertion\u00a0 Sort : <\/strong>\u00a0<\/span><\/p>\n<p><span style=\"color: #000000;\">Insert an element from unsorted array to its correct position in sorted array . In Insertion sort, we assume the first element to be sorted.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #000000;\"><strong>Advantages of Insertion sort<\/strong><\/span><\/p>\n<ol>\n<li><span style=\"color: #000000;\">Simple to code<\/span><\/li>\n<li><span style=\"color: #000000;\">Good performance with small list<\/span><\/li>\n<li><span style=\"color: #000000;\">Memory efficient<\/span><\/li>\n<\/ol>\n<p><span style=\"color: #000000;\"><strong>Disadvantages of Insertion sort<\/strong><\/span><\/p>\n<ol>\n<li><span style=\"color: #000000;\">Poor efficiency when dealing with huge list of items<\/span><\/li>\n<li><span style=\"color: #000000;\">Requires extra space<\/span><\/li>\n<li><span style=\"color: #000000;\">Not as quick as merge or quick sort<\/span><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Searching and Sorting Techniques Notes Sorting Sorting means to arrange the data either in ascending order or descending order. It is the process of rearranging a sequence of objects so as to put them in some logical order. &nbsp; &nbsp; Selection Sort :\u00a0 Find the minimum element in unsorted array and swap it with the [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,20],"tags":[],"class_list":["post-4140","post","type-post","status-publish","format-standard","hentry","category-cbse-sample-papers-class-12","category-cbse-computer-science-with-python-class-12"],"_links":{"self":[{"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/posts\/4140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/comments?post=4140"}],"version-history":[{"count":0,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/posts\/4140\/revisions"}],"wp:attachment":[{"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/media?parent=4140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/categories?post=4140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/tags?post=4140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}