![]() |
|
#1
|
|||
|
|||
ADT's - Common UsageHi all.
not been on for a while and as your help was so good last time, I was hoping you could lend me your views again. Simple question, absolutely no code involved. I'm trying to identify ways in which the follwoing ADT's could be used in a Real World environment. Stacks Queues Linked Lists Square Linked Lists Binary Tree. I have the following scenarios and any ideas you wanna throw in would be most useful. Stack - ?? stuck on this one. Queue - Could be used as a holding file for a print job. Airport take-off & landing scenario Linked Lists - for holding data in ascending/descending order as easy to search through using Binary Search Square Linked Lists - Same use as above, but used with much more data. Binary Tree - ?? but suppose somert like storing phone book details as they a search on this type of data structure is very quick. Any comments/additions most welcome. And it's not got any of my 'bad' code in to analyse. by the way, the reason I ask is this question may appear on my exam paper next week. Just trying to get a good foundation. the_crazyman |
|
#2
|
||||
|
||||
|
Quote:
2 + 3 * 1 + 8 - 3 and are to 'disassemble' the equation and executed from the right to left. 2 stacks are involved, operaors and operands. Store each number and operator on their respective stack as you move thru the equation: operand gets: 2 3 1 8 3 operator gets: + * + - Now you 1) remove them from the stack, 2 numbers per operator 2) perform the calculation 3) put the answer back on the stack: IOW, retrieve 8, 3, - (8 - 3) and get 5. Put that back on the stack: operand has: 2 3 1 5 operator has: + * + Repeat til done. Another stack example: a simple pile. Your bills start arriving. They go in a pile until you're ready to pay them. When that time comes, you take the top bill and write the check. Then the next. And so on until the money runs out. You can't look thru the bills, that would not be a stack. Quote:
Quote:
Code:
1) k, move down left (j < k) 2) d, move down right (j > d) 3) i, move down right (j > i) 4) no node there, so add j to the right of i __________________
Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough. -- Pearl Williams |
|
#3
|
||||
|
||||
|
here is some example...
Stack - A deck of card in card games like poker or solitare, also used alot in language processing, simple example writing strings backward. Queue - every message fired by a windows application is queued in the Windows Message Queue. or cars lining in a toll booth. Binary Tree - decision tree in AI application (dining decision example), parentage tree, space partitioning in harddisk or a game I used to play before where you devide the space given in binary and trap the bouncing ball in the space to the samllest space. __________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds |
|
#4
|
|||
|
|||
|
cheers for the above
much appreciated and stored in the old brain matter. Exam next week, will let you know how badly/well I do. |
Recent GIDBlog
Toyota - 2008 November Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| INtime real time system usage | Bernard | Computer Software Forum - Windows | 0 | 28-Jul-2004 05:11 |
| list of the most common keyboard and mouse shortcuts for IE, Opera and Firebird | jrobbio | Computer Software Forum - Windows | 2 | 04-Sep-2003 10:10 |
| PHP/Apache memory usage issue | bacchus | Apache Web Server Forum | 0 | 18-Aug-2003 13:57 |
| [class] Generate Forms Without Using HTML! | Elmseeker | PHP Code Library | 6 | 11-Mar-2003 13:05 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The