ASUFE Juniors
Training
Session II
Welcome to The Second Session of ASUFE Juniors
Training
• Session Agenda:
• Note about sharing problem code
• Revision on functions
• Complexity Analysis
• Problem types
• Thinking techniques
• Stack vs Heap
• Local variables vs Global variables
Note about sharing sheet
problems codes
• Do not share a code that got an accepted to the facebook group.
Why?
Revision on functions
• IDE examples
Time Complexity (Big O notation)
Time Complexity (Big O notation)
Time Complexity (Example 1)
Total runtime: O(n) - Constants are neglected
Time Complexity (Example 2)
for (size_t i = 0; i < n; i++) {
/* code */
}
for (size_t i = 0; i < n; i++) {
for (size_t j = 0; j < m; j++) {
/* code */
}
}
for (size_t i = 1; i < n; i *= 2) {
for (size_t j = 0; i < n; j++) {
/* code */
}
}
Time Complexity (Example 3)
for (size_t i = 0; i < n; i++) {
for (size_t j = i; j < n; j++) {
/* code */
}
}
≈ n + (n-1) + (n-2) + ... + 2 + 1
≈ n(n+1) / 2
≈ (n^2 + n) / 2 ≈ O(n^2)
Time Complexity (Example 4)
Task: Search for an element in a sorted array.
Time Complexity (Example 4)
Task: Search for an element in a sorted array.
Runtime Analysis:
Linear Search: O(n)
Binary Search: O(log n)
Space Analysis (Neglecting the original array):
Linear Search: O(1)
Binary Search: O(1)
Time Complexity (Summary)
Time Complexity
Most online judges run between 10^7 ~ 10^8 operation/second
Problem Types
• Brute force
• Greedy
• Ad hocs
• Divide and conquer
Problem statement
• Read the problem statement
• Think in a solution and verify it.
• Coding
• Debugging
• Testing
Problem statement
• Make sure you read the problem statement correctly.
• Reading the problem in hurry may lead that you solve another problem.
• Make sure to output the output format exactly as the problem asks.
• How codeforces and UVA judges handle new lines at the end of the output.
• Make sure to output the precision of the output as the problem asks.
• Make sure to check the problem constraints carefully.
• Don’t assume something not mentioned.
• Sometimes samples are trivial to mislead you.
• Think in papers not on pc.
Stack vs Heap
• Local variables go in the stack.
• Global variables go in the data section.
• Dynamically allocated variables go in the heap.
• Declare your variables locally vs declaring them globally.
ACM ICPC Rules
• More problems higher rank.
• If 2 contestants have the same number of problems then we see who
have a lower penalty time.
• Each problem penalty is added whenever we submit it accepted.
• Every wrong answer adds 20 mins penalty time.
Codeforces problems difficulty
• Div3 problems are the easiest.
• Div2 is harder.
• Div1 is the hardest.
• Each Div is composed of problems distributed from A to E or F
according to the contest.
• A is the easiest.
• As we go up in alphabet the problem becomes harder.
• ICPC problem distribution are different from codeforces.
ASUFE Juniors
Training
Session II

More Related Content

PPT
Kobi_H_2018_JustEnoughTesting_02_TestIL_handout
PDF
20130523 05 - Cyclomatic complexity
PDF
Improving the accuracy and reliability of data analysis code
PPTX
Measurement Metrics for Object Oriented Design
PDF
9 d57206c real time operating systems
PPT
12 boundary value problem
PDF
Algorithms overview
PDF
Алексей Ященко и Ярослав Волощук "False simplicity of front-end applications"
Kobi_H_2018_JustEnoughTesting_02_TestIL_handout
20130523 05 - Cyclomatic complexity
Improving the accuracy and reliability of data analysis code
Measurement Metrics for Object Oriented Design
9 d57206c real time operating systems
12 boundary value problem
Algorithms overview
Алексей Ященко и Ярослав Волощук "False simplicity of front-end applications"

Similar to Asufe juniors-training session2 (20)

PPTX
Case Study of the Unexplained
PDF
TDD and Related Techniques for Non Developers (2012)
PPTX
.NET Core Summer event 2019 in Vienna, AT - War stories from .NET team -- Kar...
PDF
Bigger Unit Test Are Better
PDF
Introduzione allo Unit Testing
PPTX
TDD: seriously, try it! 
PPTX
.NET Core Summer event 2019 in Linz, AT - War stories from .NET team -- Karel...
PPTX
Introduction to C ++.pptx
PPTX
.NET Core Summer event 2019 in NL - War stories from .NET team -- Karel Zikmund
PPTX
NDC Oslo 2019 - War stories from .NET team -- Karel Zikmund
PPTX
.NET Core Summer event 2019 in Brno, CZ - War stories from .NET team -- Karel...
PDF
Raising the Bar
PPTX
Issre2014 test defectprediction
PPTX
15_NEW-2020-ATTENTION-ENC-DEC-TRANSFORMERS-Lect15.pptx
PDF
Technical debt management strategies
PDF
Unit Testing Best Practices
PDF
Large Language Models for Test Case Evolution and Repair
PDF
midterm_fa07.pdf
PPTX
Introduction to TDD
PPTX
An Introduction To Software Development - Test Driven Development, Part 1
Case Study of the Unexplained
TDD and Related Techniques for Non Developers (2012)
.NET Core Summer event 2019 in Vienna, AT - War stories from .NET team -- Kar...
Bigger Unit Test Are Better
Introduzione allo Unit Testing
TDD: seriously, try it! 
.NET Core Summer event 2019 in Linz, AT - War stories from .NET team -- Karel...
Introduction to C ++.pptx
.NET Core Summer event 2019 in NL - War stories from .NET team -- Karel Zikmund
NDC Oslo 2019 - War stories from .NET team -- Karel Zikmund
.NET Core Summer event 2019 in Brno, CZ - War stories from .NET team -- Karel...
Raising the Bar
Issre2014 test defectprediction
15_NEW-2020-ATTENTION-ENC-DEC-TRANSFORMERS-Lect15.pptx
Technical debt management strategies
Unit Testing Best Practices
Large Language Models for Test Case Evolution and Repair
midterm_fa07.pdf
Introduction to TDD
An Introduction To Software Development - Test Driven Development, Part 1
Ad

Recently uploaded (20)

PDF
Engineering Document Management System (EDMS)
PDF
WhatsApp Chatbots The Key to Scalable Customer Support.pdf
PDF
Sanket Mhaiskar Resume - Senior Software Engineer (Backend, AI)
PDF
Understanding the Need for Systemic Change in Open Source Through Intersectio...
PDF
AI-Powered Fuzz Testing: The Future of QA
PDF
SOFTWARE ENGINEERING Software Engineering (3rd Edition) by K.K. Aggarwal & Yo...
PDF
MiniTool Power Data Recovery 12.6 Crack + Portable (Latest Version 2025)
PPTX
Bandicam Screen Recorder 8.2.1 Build 2529 Crack
PDF
IT Consulting Services to Secure Future Growth
PDF
Odoo Construction Management System by CandidRoot
PPTX
A Spider Diagram, also known as a Radial Diagram or Mind Map.
PDF
CapCut PRO for PC Crack New Download (Fully Activated 2025)
PPTX
Human-Computer Interaction for Lecture 2
PPTX
Chapter 1 - Transaction Processing and Mgt.pptx
PPTX
UNIT II: Software design, software .pptx
PPTX
HackYourBrain__UtrechtJUG__11092025.pptx
PPTX
Lesson-3-Operation-System-Support.pptx-I
PPTX
WJQSJXNAZJVCVSAXJHBZKSJXKJKXJSBHJBJEHHJB
PDF
Top 10 Project Management Software for Small Teams in 2025.pdf
PDF
Building an Inclusive Web Accessibility Made Simple with Accessibility Analyzer
Engineering Document Management System (EDMS)
WhatsApp Chatbots The Key to Scalable Customer Support.pdf
Sanket Mhaiskar Resume - Senior Software Engineer (Backend, AI)
Understanding the Need for Systemic Change in Open Source Through Intersectio...
AI-Powered Fuzz Testing: The Future of QA
SOFTWARE ENGINEERING Software Engineering (3rd Edition) by K.K. Aggarwal & Yo...
MiniTool Power Data Recovery 12.6 Crack + Portable (Latest Version 2025)
Bandicam Screen Recorder 8.2.1 Build 2529 Crack
IT Consulting Services to Secure Future Growth
Odoo Construction Management System by CandidRoot
A Spider Diagram, also known as a Radial Diagram or Mind Map.
CapCut PRO for PC Crack New Download (Fully Activated 2025)
Human-Computer Interaction for Lecture 2
Chapter 1 - Transaction Processing and Mgt.pptx
UNIT II: Software design, software .pptx
HackYourBrain__UtrechtJUG__11092025.pptx
Lesson-3-Operation-System-Support.pptx-I
WJQSJXNAZJVCVSAXJHBZKSJXKJKXJSBHJBJEHHJB
Top 10 Project Management Software for Small Teams in 2025.pdf
Building an Inclusive Web Accessibility Made Simple with Accessibility Analyzer
Ad

Asufe juniors-training session2

  • 2. Welcome to The Second Session of ASUFE Juniors Training • Session Agenda: • Note about sharing problem code • Revision on functions • Complexity Analysis • Problem types • Thinking techniques • Stack vs Heap • Local variables vs Global variables
  • 3. Note about sharing sheet problems codes • Do not share a code that got an accepted to the facebook group. Why?
  • 5. Time Complexity (Big O notation)
  • 6. Time Complexity (Big O notation)
  • 7. Time Complexity (Example 1) Total runtime: O(n) - Constants are neglected
  • 8. Time Complexity (Example 2) for (size_t i = 0; i < n; i++) { /* code */ } for (size_t i = 0; i < n; i++) { for (size_t j = 0; j < m; j++) { /* code */ } } for (size_t i = 1; i < n; i *= 2) { for (size_t j = 0; i < n; j++) { /* code */ } }
  • 9. Time Complexity (Example 3) for (size_t i = 0; i < n; i++) { for (size_t j = i; j < n; j++) { /* code */ } } ≈ n + (n-1) + (n-2) + ... + 2 + 1 ≈ n(n+1) / 2 ≈ (n^2 + n) / 2 ≈ O(n^2)
  • 10. Time Complexity (Example 4) Task: Search for an element in a sorted array.
  • 11. Time Complexity (Example 4) Task: Search for an element in a sorted array. Runtime Analysis: Linear Search: O(n) Binary Search: O(log n) Space Analysis (Neglecting the original array): Linear Search: O(1) Binary Search: O(1)
  • 13. Time Complexity Most online judges run between 10^7 ~ 10^8 operation/second
  • 14. Problem Types • Brute force • Greedy • Ad hocs • Divide and conquer
  • 15. Problem statement • Read the problem statement • Think in a solution and verify it. • Coding • Debugging • Testing
  • 16. Problem statement • Make sure you read the problem statement correctly. • Reading the problem in hurry may lead that you solve another problem. • Make sure to output the output format exactly as the problem asks. • How codeforces and UVA judges handle new lines at the end of the output. • Make sure to output the precision of the output as the problem asks. • Make sure to check the problem constraints carefully. • Don’t assume something not mentioned. • Sometimes samples are trivial to mislead you. • Think in papers not on pc.
  • 17. Stack vs Heap • Local variables go in the stack. • Global variables go in the data section. • Dynamically allocated variables go in the heap. • Declare your variables locally vs declaring them globally.
  • 18. ACM ICPC Rules • More problems higher rank. • If 2 contestants have the same number of problems then we see who have a lower penalty time. • Each problem penalty is added whenever we submit it accepted. • Every wrong answer adds 20 mins penalty time.
  • 19. Codeforces problems difficulty • Div3 problems are the easiest. • Div2 is harder. • Div1 is the hardest. • Each Div is composed of problems distributed from A to E or F according to the contest. • A is the easiest. • As we go up in alphabet the problem becomes harder. • ICPC problem distribution are different from codeforces.