0

Creating own LIFO Queue in Python using object references

Hey there A few years ago I took a programming course about java in school. We tried to create our own bank system: To create a list of transactions of a bank-account we referenced each transaction-object of each account respectively to the transaction-object before. Thereby creating sort of a LIFO list of object-references. Of course this ‘list’ was different for each bank-account. 
I am now wondering myself, whether this approach has any benefits compared to stacks? Currently I am trying to recreate the program in python, but I can’t figure out an easy way to implement that system. It seems far easier to solve the problem with a dictionary, but than again, a dictionary would be directly accessible and I guess in theory therefore not as safe? I hope that made sense ^^’

2nd Sep 2020, 8:14 PM
Jonathan Remmert
3 Réponses
3rd Sep 2020, 12:24 AM
Oma Falk
Oma Falk - avatar
+ 2
Recreating a stack in Python is fairly simple. You can use the built in type list and wrap it in a class to accomplish this. https://www.sololearn.com/learn/680/?ref=app
3rd Sep 2020, 12:28 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
I think with the help of your links I found was I was looking for. Apparantly we created a singly linked list using Node classes. I will try to implement that into python. Thank you :)
3rd Sep 2020, 6:20 AM
Jonathan Remmert