/k0nzeProgamming, Computer Science, and Everything in Between 2023-01-22T13:29:37+01:00 k0nze / Konstantin Lübeck / Jekyll © 2023 k0nze / Konstantin Lübeck /assets/img/favicons/favicon.ico /assets/img/favicons/favicon-96x96.png Two Sum Problem Solution in C++ in O(n)2022-11-27T14:00:00+01:00 2022-11-27T14:00:00+01:00 /posts/two-problem-solution-cpp/ k0nze The “Two Sum Problem” is described as follows: Given an array of integers nums and an integer target, return the indices of the two integers in nums such that they add up to target. See Leetcode “Two Sum Problem” A solution with a time complexity of \(O(n)\) in pseudo code solution looks like this: array nums // contains random number of elements target arrray result_indices set partial_sums... Python @staticmethod vs @classmethod2022-03-15T14:00:01+01:00 2022-11-27T20:24:38+01:00 /posts/python-staticmethod-vs-classmethod/ k0nze Python Functions are First-class Objects In Python functions are first-class objects which means that functions can be assigned to variables or passed as an argument for another function in the same manner as primitive data types and objects. For example, in the following code, the function operator has three parameters operation, x, and y. While x and y can be primitive data types, operati... What is Python __name__ == '__main__'?2022-03-08T14:00:00+01:00 2022-11-27T20:24:38+01:00 /posts/python-name-main/ k0nze You might have seen the Python line if __name__ == "__main__": in several code examples and wonder what does it do? Many other programming languages such as Java or C/C++ require a main function as the starting point for an application. However, in Python you can type some lines of code in a file, and the code is executed just fine without the need for a main. So why is there a need for addin... Big O Notation Explained2022-02-23T18:45:00+01:00 2022-11-27T20:24:38+01:00 /posts/big-o-notation/ k0nze Why is Big O Notation Used? When you got different algorithms to solve the same problem, you need to compare those to each other to pick the best (meaning fastest) for your program. Looking at each algorithm’s (pseudo-) code will give you an insight into how they work and what data structures they rely on. However, that doesn’t tell you how long you have to wait until the algorithm finishes an... Python Course #18: Your First Sorting Algorithm (Insertion Sort Explained)2022-02-09T09:00:00+01:00 2022-11-27T20:24:38+01:00 /posts/python-insertion-sort/ k0nze With the knowledge of Python functions and algorithms, we are ready to write our first sorting algorithm and also take a closer look at how fast it runs. What is a Sorting Algorithm A sorting algorithm’s purpose is to reorder a list of elements based on a comparison criterion. This criterion is usually a less than operator < applied to the values of two numbers. However, you can use any ...