Ok guys i have 2 questions, i am learning data structures so how to use stacks? tutor says that if u want to use stacks its better to back stack with linkedlist create extra class and define methods there because linkedlist implements deque interface too, but i searched in google and people create stacks by itself like stack<String> example = new stack<string>(); why ?
#Java data structures
12 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @ocean marlin! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
and can u show me real life prroejct where u use stacks
It's just that Java's java.util.Stack class is outdated. All accesses to it are synchronized, which might have sounded like a good idea at the time, but takes a performance toll that nobody wants in practice.
LinkedList replaces it fine.
a real life example would be writing a program which identifies if all brackets in a given String are closed correctly or to convert an infix mathematical term, to a postfix mathematical term which is easier to calculate.
ok thank you guys
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
so hashsets is good data s tructure because every element is unique right?
that's a little bit of a jump here. First we talk about stacks now we are at HashSets. Can you define what you mean by "good data structure" ?
every element in hashets are unique
yeah that is correct.