{"id":154130,"date":"2023-08-02T15:10:16","date_gmt":"2023-08-02T09:40:16","guid":{"rendered":"https:\/\/www.gkseries.com\/blog\/?p=154130"},"modified":"2023-08-02T15:10:20","modified_gmt":"2023-08-02T09:40:20","slug":"there-are-n-unsorted-arrays-a1-a2-an-assume-that-n-is-odd-each-of-a1-a2-an-contains-n-distinct-elements-there-are-no-common-elements-between-any-two-arrays","status":"publish","type":"post","link":"https:\/\/www.gkseries.com\/blog\/there-are-n-unsorted-arrays-a1-a2-an-assume-that-n-is-odd-each-of-a1-a2-an-contains-n-distinct-elements-there-are-no-common-elements-between-any-two-arrays\/","title":{"rendered":"There are n unsorted arrays: A1, A2, \u2026, An. Assume that n is odd. Each of A1, A2, \u2026, An contains n distinct elements. There are no common elements between any two arrays"},"content":{"rendered":"\n<p>Q. There are <em>n <\/em>unsorted arrays: <em>A<\/em>1, <em>A<\/em>2, \u2026, <em>An<\/em>. Assume that <em>n <\/em>is odd. Each of <em>A<\/em>1, <em>A<\/em>2, \u2026, <em>An <\/em>contains <em>n <\/em>distinct elements. There are no common elements between any two arrays. The worst-case time complexity of computing the median of the medians of <em>A<\/em>1, <em>A<\/em>2, \u2026, <em>An <\/em>is<\/p>\n\n\n\n<p>(A) <em>O<\/em>(<em>n<\/em>)<\/p>\n\n\n\n<p>(B) <em>O<\/em>(<em>n <\/em>log <em>n<\/em>)<\/p>\n\n\n\n<p>(C) <em>O<\/em>(<em>n<\/em><sup>2<\/sup>)<\/p>\n\n\n\n<p>(D) \u03a9(<em>n<\/em><sup>2<\/sup> log <em>n<\/em>)<\/p>\n\n\n\n<p>Ans: \u039f(n<sup>2<\/sup>)<\/p>\n\n\n\n<p>Solution:<\/p>\n\n\n\n<p>= O(n)*O(n) + O(n)<\/p>\n\n\n\n<p>= O(n2) + O(n)<\/p>\n\n\n\n<p>\u2248 O(n2)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Q. There are n unsorted arrays: A1, A2, \u2026, An. Assume that n is odd. Each of A1, A2, \u2026, An contains n distinct elements. There are no common elements between any two arrays. The worst-case time complexity of computing the median of the medians of A1, A2, \u2026, An is (A) O(n) (B) O(n [&hellip;]<\/p>\n","protected":false},"author":419,"featured_media":154135,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[5141],"tags":[5140],"class_list":["post-154130","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-gate","tag-gate-questions"],"_links":{"self":[{"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/posts\/154130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/users\/419"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/comments?post=154130"}],"version-history":[{"count":1,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/posts\/154130\/revisions"}],"predecessor-version":[{"id":154136,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/posts\/154130\/revisions\/154136"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/media\/154135"}],"wp:attachment":[{"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/media?parent=154130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/categories?post=154130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/tags?post=154130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}