Stack Using Golang Generics
With the recent introduction of generics in Golang , they have proved themselves not only elegant and simple, but also very efficient, check out the performance characteristics here . Now it is time to demonstrate their power in creating flexible data structures in this post. As promised in a later post , we are going to implement a stack in this post. The rest of this post is organized as follows: what is a stack stack methods implementation in Golang testing our stack NOTE THAT ALL CODE SNIPPETS FOUND IN THIS POST CAN BE FOUND HERE What is a Stack Stacks are simple data structures that powers a great deal of modern computational systems like function calls in compilers themselves, LRU policy of memory block replacements, bracket matching problems and many many more. Stacks were first introduced in 1964 by Alan M. Turing and they were gaining popularity ever since. A stack acts as a first in last out data structure most commonly known as LIFO. In layman terms this means it is a dat