Adding and removing items from a list in Python
Adding and removing items from a list in Python problem You are using a list in your Python program and wish to add and remove items. In this post we will see built-in functions that allow us to manipulate the items in the list. SOLUTION Adding an item Let’s suppose we have a list named […]
Using a set in Python
Using a set in python problem You’re learning Python and you wish to use a Set data structure. A set in programming origins from the mathematical notion of a set. This means, they’re only distinct values, no duplicates. SOLUTION Python comes with a built-in Set data structure. In order to use it we need to […]
Using a Queue in Java
Using a Queue in java problem You wish to use the Queue data structure in Java. It is a FIFO – First In First Out data structure meaning the first item that is added is firstly retrieved. Analogous to a queue of people standing to get a ticket at the cinema. SOLUTION – LinkedList Java […]
Using a Stack in Java
Using a Stack data structure in Java problem You wish to use the Stack in Java. This data structure “stacks” data elements one on top of the other hence its name. Similar to the analogy of plates when we stack one on top of the other. It is also known as a LIFO (Last In […]