473,399 Members | 3,656 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Simple question about LIFO....

AmberJain
884 Expert 512MB
HELLO,
The book (which I'm presently referring) of C programming says-
"A stack is an example of a LIFO (Last In First Out) structure, as opposed to, for example, a queue, which is a FIFO (First In First Out) structure."

Now I have some questions about above statement:
1. What does "structure" in above statement stands for?
2. Is it possible to code a program which has the ability to extract data items from stack in any random order (i.e. neglecting LIFO)?
3. What is "queue"?
4. Can we call FILO as LIFO?
5. Can we call LILO as FIFO?

THANKS in advance.............
AmbrNewlearner
Jul 21 '08 #1
5 2283
Laharl
849 Expert 512MB
1. Structure here refers to data structures, which are objects that hold data and support certain operations on that data.
2. Sure, but it wouldn't be a stack, it'd probably be a hash of some sort.
3. A queue is a data structure similar to a stack, but you add and remove from opposite ends.
4. Yep.
5. Yep.
Jul 21 '08 #2
AmberJain
884 Expert 512MB
first of all, THANKS..............

1. Structure here refers to data structures, which are objects that hold data and support certain operations on that data.
OK fine............

2. Sure, but it wouldn't be a stack, it'd probably be a hash of some sort.
Can you explain this in a bit more detail? Or please provide me with some link to a good online tutorial.

3. A queue is a data structure similar to a stack, but you add and remove from opposite ends.
OK, fine........


THANKS again.....
Jul 21 '08 #3
Laharl
849 Expert 512MB
Can you explain this in a bit more detail? Or please provide me with some link to a good online tutorial.
The abstract concept of a stack is a container that only supports insertion, checking, and removal of an element at one end (specified in the implementation and transparent to the user). If you're accessing random elements, you're not using a stack, but some other data structure instead. There are several different randomized (or seemingly randomized) data structures, which you can find out more about with Google, just like stacks.
Jul 21 '08 #4
JosAH
11,448 Expert 8TB
Most of the existing applications behave as if they are a GIGO ADT though:
Garbage In, Garbage Out. Unfortunately a lot of corporations rely on that mess
and even more unfortunate: they don't even realize it.

kind regards,

Jos
Jul 22 '08 #5
AmberJain
884 Expert 512MB
The abstract concept of a stack is a container that only supports insertion, checking, and removal of an element at one end (specified in the implementation and transparent to the user). If you're accessing random elements, you're not using a stack, but some other data structure instead. There are several different randomized (or seemingly randomized) data structures, which you can find out more about with Google, just like stacks.
THANKS,,,...........OK, I will search google for more.



Most of the existing applications behave as if they are a GIGO ADT though:
Garbage In, Garbage Out. Unfortunately a lot of corporations rely on that mess
and even more unfortunate: they don't even realize it.
:=)
Jul 23 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: JKop | last post by:
Take the following simple function: unsigned long Plus5Percent(unsigned long input) { return ( input + input / 20 ); } Do yous ever consider the possibly more efficent:
13
by: Michael B Allen | last post by:
Hi, I've tried to write the *simplest* memory allocator possible. I think it would be useful in many cases such as allocating memory on stack as a poor man's garbage collection perhaps. I was...
8
by: Beam_Us_Up_Scotty | last post by:
Hello all, I am trying to write a "simple" animation using C#, and I've tried many things but nothing seems to work for me without leaking memory. Here's a very simple piece of code that uses a...
7
by: abcd | last post by:
I am trying to set up client machine and investigatging which .net components are missing to run aspx page. I have a simple aspx page which just has "hello world" printed.... When I request...
10
by: serge calderara | last post by:
Dear all, I need to build a web application which will contains articles (long or short) I was wondering on what is the correct way to retrive those article on web page. In orther words, when...
4
by: aaron.kempf | last post by:
i need a status box on my etl tool-- where i can 'trap' the 20 most recent status messages. i don't want to do a whole bunch of parsing of text; and string concat. Dim s As New Stack() ...
14
by: Giancarlo Berenz | last post by:
Hi: Recently i write this code: class Simple { private: int value; public: int GiveMeARandom(void);
1
by: =?ISO-8859-1?Q?Tor_Erik_S=F8nvisen?= | last post by:
Hi, A while ago I asked a question on the list about a simple eval function, capable of eval'ing simple python constructs (tuples, dicts, lists, strings, numbers etc) in a secure manner:...
17
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /*...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.