Talk:Stack (data structure)
From Wikipedia, the free encyclopedia
Contents |
[edit] Rename
I think this article should be named stack (computer science) since the concept of stack is used other than making computer software? Any objection? -- Taku 00:47, 6 Sep 2003 (UTC)
- Stack (computing)? Nice, generic term... Includes CS and software dev't too. Dysprosia 00:49, 6 Sep 2003 (UTC)
- It is fine too. Any other thoughs?
[edit] Merge
(to Martin) Hi, I see you merged stack pointer into Stack. Are you sure it's not an important enough idea to merit a separate article? There are a number of pages that link to stack pointer (and I was about to add a few more :-). Noel 20:04, 18 Oct 2003 (UTC)
- Prove me wrong and write a long and well-written article on a stack pointer if you like.. but the version I merged didn't seem worth a seperate article. Martin 22:29, 20 Oct 2003 (UTC)
[edit] Image
I made an image for the german pendant to a stack (de:Kellerspeicher), perhaps you want to include it here. Is there a possibility to reuse the one from there or does it need a second upload? TRauMa, 2003-11-26
I made my own stack image because I have a hard time seeing the one that is currently in the article (the contrast of the different shades of blue makes it hard for me to see the edges). The different layers are slightly transparent to make it more apparent that there are different layers. Is this acceptable? [[User:Aranel|Aranel ("Sarah")]] 17:27, 25 Oct 2004 (UTC)
[edit] LIFO / FIFO ?
Are all stacks LIFO? Aren't there FIFO stacks too? BradGad (Talk) 21:55, 21 Mar 2005 (UTC)
- A "FIFO stack" would be a queue, I believe. anetor 07:45 07 Apr 2005 (PDT)
- "FIFO" refers to a queue. cslave 21 Sept 2005
[edit] Stack (computing) merge with Stack-Based Memory Allocation
I believe Stack-Based Memory Allocation should be merged into this article because most of the information is redundant. Thoughts? --Dan Granahan 15:08, 2 August 2005 (UTC)
- Agreed. -- Taku 22:58, August 2, 2005 (UTC)
- I Second -- cslave 21 Sept, 2005
- The Stack-Based Memory Allocation article is total crap and should be deleted. -- John Tsiombikas 15 oct. 2005
- Stack-Based Memory Allocation is an architecture article and thus is juxtaposed against Heap-Based Memory Allocation. The article here is about a more implementation-free stack and Stack machine describes a stack as a device unto itself. All three perspectives are useful, and Stack pointer aligns more with the architechture area. Hackwrench 01:38, 6 November 2005 (UTC)
[edit] Rotate method?
What is this rotate method for? What languages implement it? its not in the standard java lib...
- Stack manipulation beyond pushing and popping is very useful in stack-oriented languages. Also, some dialects of Lisp will rotate on lists. Tsowell 11:40, 10 October 2006 (UTC)
- The rotation visualization is confusing because it uses the same values in what look like different positions to contrast the visualization. The stack data is described by numerical position and the right-rotate process is described as, "right rotate will move the first element to the third position, the second to the first and the third to the second". A purely numerical representation of data items in a stack could be viewed as insufficient because the positions and the data items would both be represented numerically, thus easily confusing the reader. While the visualization IS equivalent, it is overly complex because it requires the reader to decipher the initial positioning by comparing the two data flows without indication of top to bottom or right to left priorities.
- This is the current example:
apple banana banana ==right rotate==> cucumber cucumber apple
- and
cucumber banana apple ==right rotate==> apple cucumber banana
- Pure numeric representation would work as long as the article stated that the numbers were values within the stack and not indicative of the actual address within the stack. So the examples could be:
Bottom Up (Top to bottom):
1 2 2 right rotate => 3 3 1
Left to Right:
3 2 1 == right rotate == > 1 3 2
- Both of the designations in the paragraph above the visualization become misleading without an indication of direction. When most people think about left to right they assume they will read 0 1 2 3 from left to right on the page. The same applies to the term bottom up.
- As defined in the article, the first and second positions rotate, then the second and third positions rotate. An animated diagram may be better.
- As it is, ROL 1 2 3 > 2 3 1 works fine for the example, but when you get into a larger stack what happens? Does 1 2 3 4 5 6 rotate each item in series? 2 3 4 5 6 1 ?
- Why not define it as: "Right Rotate moves the first item to the last position". If it functions as described it will always do that. The fact that it seems to be explained in terms of a sequential rotation involving two items at a time with the accompanying visualizations seems like a way to make the simple overly complex.
- An example using the 6502 processor (motorola) is found here: http://www.atariarchives.org/roots/chapter_9.php (that would also cover early Apple Machines).
[edit] Peak?
Is this anything more than a falsely-justified spelling error? I can't find any such usage on Google. "Top", on the other hand, is a fairly widely-used alternative to "peek". Tsowell 11:40, 10 October 2006 (UTC)
- As stated, the term 'peak' isn't a spelling error. Here is source found on the second page of google, searching for 'stack peak': http://www-db.stanford.edu/~burback/containers/stack.cpp
- The function is meant to show the peak (top, acme, etc) of the stack without removing and returning it.
- There have been many terms used to describe this, I prefer 'peak', but if you feel 'top' should be added, I wouldnt' have any objections.
- On an off note, I do ask that people not edit things to change 'peak' to 'peek', since 'peak' is mentioned, it is a bit of an inane edit.
- Reikon 23:02, 16 October 2006 (UTC)
-
- Methods/functions are, by convention, verbs, just as objects are nouns. Therefore, 'peek' is better than 'peak' or 'top'. 'peak' also suggests a root of a tree (peak of a mountain?) to some in my experience. --David Federman 05:27, 24 November 2006 (UTC)
- I strongly prefer peek to peak. I learned peek and top 20 years ago but this is the first time I've seen peak. When I Google'd (before reading this discussion) I found the stanford/burback source listed above - and I think it is a spelling error. I vote for peek as the primary spelling, with top (long established) and peak (reluctantly) as alternates. Manassehkatz 03:25, 4 December 2006 (UTC)
-
- I found a textbook reference to TOP and adjusted the page accordingly. If anyone can find a citation (not just code on a webpage) earlier than 1984 showing PEEK or PEAK, please feel free to change. I also changed the pseudocode to pass data elements rather than nodes (data + pointer) as the push/pop/top functions should hide the pointer implementation details. Manassehkatz 15:31, 4 December 2006 (UTC)
[edit] JVM
Does anyone else think that the mention of the JVM in the intro paragraph is a bit excessive? It makes it sound like the JVM is some integral low-level part of the OS. —The preceding unsigned comment was added by 209.234.66.97 (talk • contribs) 07:02, November 26, 2006 (UTC).