HackerRank icon indicating copy to clipboard operation
HackerRank copied to clipboard

Question: How is sorting defined as (n+m) log(n+m)? Shouldn't it be nlogn +mlogm?

Open tseth92 opened this issue 6 years ago • 1 comments

nlogn for drives and mlogm for keyboard. So, if you sort both independently, shouldn't it be mlogm+nlogn , instead of (m+n)log(m+n) ?

tseth92 avatar Jul 18 '19 06:07 tseth92

This is Big O notation signifying the class of problem. This post should help explain how the notation works and the mathematical thought behind it: http://forums.codeguru.com/showthread.php?491516-how-is-O(logm-logn)-O(log(m-n))-O-is-big-oh

On Wed, Jul 17, 2019, 11:37 PM tseth92 [email protected] wrote:

nlogn for drives and mlogm for keyboard. So, if you sort both independently, shouldn't it be mlogm+nlogn , instead of (m+n)log(m+n) ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/RyanFehr/HackerRank/issues/243?email_source=notifications&email_token=AEWZT3I774ATLB5CQJ7QHITQAAFR5A5CNFSM4IEXNAYKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G75OIJA, or mute the thread https://github.com/notifications/unsubscribe-auth/AEWZT3PLSX33BOCWOOLCNJ3QAAFR5ANCNFSM4IEXNAYA .

RyanFehr avatar Jul 18 '19 07:07 RyanFehr