DEV Community

Adhyan Jain
Adhyan Jain

Posted on • Edited on

Week 4 of C++: Revision & Problem-Solving

This week was focused on revising pointers and structures, along with exploring two-pointer techniques and Floyd’s cycle detection theorem. I also participated in 6 contests across Codeforces, AtCoder, CodeChef, and LeetCode, improving my problem-solving under time constraints.

🔹Pointers Revision (Day 22-24)

I spent the first three days revisiting pointers, covering:

  • Pointer arithmetic and how it interacts with arrays
  • Function pointers and their applications
  • Common mistakes like memory leaks and segmentation faults

This helped solidify concepts essential for memory management and performance optimization.

🔹Two-Pointer & Cycle Detection (Day 25)

Day 25 was dedicated to learning the two-pointer technique and Floyd’s cycle detection theorem:

  • Two-pointer approach helps optimize problems involving sorted arrays, searching, and merging.
  • Floyd’s Tortoise and Hare Algorithm is useful for detecting cycles in linked lists efficiently.

Both techniques are widely used in competitive programming and provide significant time complexity improvements.

🔹Structures Revision (Day 26 & 28)

I revised structures and their applications, including:

  • Arrays of structures
  • Nested structures
  • Pointers to structures

This was a quick refresher, as structures are fundamental for organizing complex data and transitioning into OOP.

🔹Problem-Solving & Contests (Day 27)

Day 27 was all about applying concepts in real problems. I solved challenges on Codeforces and worked on:

  • Two-pointer-based problems
  • Cycle detection in linked lists
  • Structuring data efficiently in problem-solving

Regular practice is helping me improve both speed and accuracy in coding contests.

🔹Key Takeaways

  • Pointers and structures are foundational concepts that need strong command.
  • Two-pointer and cycle detection techniques significantly optimize problem-solving.
  • Consistent contest participation enhances coding speed and adaptability.

🔹What’s Next?

Next week, I plan to:

  • Solve more competitive programming problems
  • Explore additional optimization techniques

🔹Connect With Me

Check out my work here:

Have you used the two-pointer approach before? Let’s discuss in the comments!

Top comments (0)