Popular posts from this blog
Bubble sort and Modified Bubble sort
Given two sorted arrays of size m and n .Find the number of common elements in them and also find what are that common elements.
This can be done in 3 ways :(considering worst case)//only for sorted 1. O(m*n) // if m == n, then (n*n) 2. O(nLog(m))// if m>n else O(mLog(n)) Using Binary search 3. O(m + n) // this is optimal worst case time// using concept of merge sort for example : array a[] = { 10,20,30.40,50,60,70,80,90};//only for sorted array b[] = { 10,15,20,25,30}; output : 10 20 30 number of same elements : 3 follow me on : Instagram Twitter LinkedIn my website facebook Whatsapp gmail
Comments
Post a Comment