📄 Abstract
In our Python class we came across a simple but quite interesting problem — what if you have a list where some values repeat one after another, and you want to keep those repeated values together in their own smaller lists? For example, if the list is [1,1,2,3,3,3,4,4,5], the output should look like [[1,1],[2],[3,3,3],[4,4],[5]]. This kind of grouping is called packing consecutive duplicates into sublists. When we first encountered this, we tried to solve it ourselves and later discovered that Python already has a built-in tool called itertools.groupby() that does exactly this. So, we decided to compare our own manual solution with the library method, not just in terms of what they produce, but in terms of how efficient they are — using time complexity and space complexity expressed through Big O, Big Theta, and Big Omega notations. This paper documents everything we found.
🏷️ Keywords
📚 How to Cite:
S Navanitha Krishnan, S Hari Santh , PACKING CONSECUTIVE DUPLICATES OF LIST ELEMENTS INTO SUBLISTS USING itertools.groupby MODULE AND MANUAL APPROACH: A COMPARATIVE STUDY USING ASYMPTOTIC NOTATIONS - A CASE STUDY , Volume 12 , Issue 6, June 2026, EPRA International Journal of Multidisciplinary Research (IJMR) , Pages: 689 - 694 ,