How to compare two time complexities in Big-O terms for F1 vs F2

TL;DR
F1 grows faster than F2 for large inputs because N^2 log N dominates N log N. By testing with large values of N you can see F1 become the dominating term, so F2N is O(F1N). This method helps decide which complexity is bigger in exam questions and confirms the asymptotic relationship.
Transcript
Hello friends, welcome to Gate Smashers In this video, we are going to discuss through an example that how we compare time complexities with each other. Means which time complexity is big and which is small. To discuss this, we are going to discuss an example here. In the last video, we have already discussed that how we compare the same time compl... Read More
Key Insights
- F1 is defined as N^2 log N which grows faster than F2 which is N log N, establishing a primary dominance based on product of polynomial and logarithmic factors.
- The key to comparing these functions is to consider large values of N to expose the dominating term, since small values can be misleading.
- Simplifying the product form by factoring out N and using log properties helps reveal the relative growth more clearly.
- When placing large N values such as 10^9, the comparison becomes more straightforward and highlights which term dominates more definitively.
- Constant factors do not affect Big-O relations, so their influence is ignored in determining dominance between F1 and F2.
- If F2N is shown to be within a constant multiple of F1N, then F2N is O(F1N), indicating F1N dominates asymptotically.
- The practical method can be summarized as two approaches: direct value substitution for large N and algebraic simplification to compare orders.
- The final conclusion from the example is that F2N is O(F1N), meaning F1N grows at least as fast as F2N and determines the overall growth rate.
- More videos from this channel:
- More from this channel: Gate Smashers
Install to Summarize YouTube Videos and Get Transcripts
Explore YouTube Video Summarizer or Get YouTube Transcript Extractor
Questions & Answers
Q: What are F1 and F2 in the video explanation
F1 is defined as N squared times log N, while F2 is defined as N times log N. The comparison focuses on how these two expressions grow as N increases, particularly identifying which term becomes dominant for large N. The video shows that F1 grows faster than F2 because of the extra N factor multiplying the log term, leading to a larger overall growth rate as N increases.
Q: What method is suggested first to compare the complexities
The first method suggested is to substitute large values for N to observe how the two expressions behave. By choosing a large N, such as 10 raised to the 9th power, you can compare the resulting values directly and determine which term dominates. This empirical approach helps visualize asymptotic dominance beyond algebraic manipulation.
Q: Why is testing with large values of N important
Testing with large values of N is important because small values can mislead the comparison due to constant factors or lower-order terms. Large values emphasize the highest-order growth terms, making it clear which complexity will dominate as input sizes scale. This aligns with the Big-O concept which focuses on asymptotic behavior.
Q: What simplification technique is shown in the video
The video demonstrates simplifying by factoring out common terms and using logarithm properties to cancel terms. Specifically, canceling N terms and reducing the log factors helps reveal the remaining growth factors, allowing a cleaner comparison between the two expressions while ignoring constants.
Q: What conclusion is drawn about F2N relative to F1N
The conclusion drawn is that F2N is O(F1N), meaning F2N is bounded above by a constant multiple of F1N for large N. This indicates that F1N dominates asymptotically, as the added N factor in F1 leads to a faster growth rate compared to F2N.
Q: How does the video address constants in Big-O comparisons
The video notes that constants do not affect Big-O comparisons, so they can be ignored when assessing asymptotic growth. This is why the focus is on the dominating factors such as N and log N, rather than constant multipliers that may appear in the expressions.
Q: What practical takeaway is provided for exam preparation
The practical takeaway is to use large-N testing or simplification to identify the dominant term quickly, especially in exam questions. By recognizing that F1 grows faster due to the extra N factor, students can determine the correct Big-O relation without lengthy algebraic manipulation.
Q: What is the overall message about comparing time complexities
The overall message is that comparing time complexities benefits from examining large inputs and employing simplification techniques. This helps determine which term dominates, enabling a clear determination of Big-O or omega relationships and supporting efficient problem solving in algorithm questions.
Summary & Key Takeaways
-
In this video, the trainer explains a practical method to compare two time complexities by testing with large input values to identify the dominating term. The example uses F1 as N^2 log N and F2 as N log N, showing how larger inputs reveal which term dominates. The takeaway is to use big values to determine asymptotic order and conclude which function is bigger.
-
The approach includes two methods: putting values in the functions and simplifying the expressions to compare growth rates. It emphasizes that constants do not affect Big-O relationships and that large-N testing clarifies which term dominates.
-
The practical outcome is a rule: F2N is order of F1N, meaning F1N grows at least as fast as F2N. This helps students quickly decide the correct Big-O relation in typical exam questions without getting bogged down in algebra.
Read in Other Languages (beta)
Share This Summary 📚
Summarize YouTube Videos and Get Video Transcripts with 1-Click
Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator
Explore More Summaries from Gate Smashers 📚






Summarize YouTube Videos and Get Video Transcripts with 1-Click
Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator