943,694 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 864
  • C RSS
Feb 10th, 2009
0

Stacks and trees

Expand Post »
Can anyone give me some examples on how to apply stacks and trees..
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
JONZ is offline Offline
9 posts
since Sep 2008
Feb 10th, 2009
0

Re: Stacks and trees

stacks can be implemented using array .take a variable which is nothing but index of the position in which we can insert data,call it top and increment it whenever we
insert and decrement it by one whenever we pop out something
Reputation Points: 4
Solved Threads: 0
Newbie Poster
priyankasaini is offline Offline
4 posts
since Feb 2009
Feb 10th, 2009
0

Re: Stacks and trees

@JONZ

Your question doesn't specify your need correctly.Well I could frame two questions out of it. So answering them.

1)How to create stacks and trees?

Stacks can be created using many methods. By Arrays, using a variable to act as top indicator. By Linked List, using a node pointer to act as top indicator.

2)Where can you apply stacks and trees?

Stacks can be applied for various applications.
Ex : Reversal of a string.
Trees are applied where ever solution to the problem needs branching of decisions at various levels according to requisites.
Ex : T9 dictionary in mobiles.
Reputation Points: 485
Solved Threads: 88
Posting Pro
csurfer is offline Offline
564 posts
since Jan 2009
Feb 10th, 2009
0

Re: Stacks and trees

Click to Expand / Collapse  Quote originally posted by csurfer ...
0
Trees are applied where ever solution to the problem needs branching of decisions at various levels according to requisites.
Ex : T9 dictionary in mobiles.
There also an important use of Trees in gaming Applications like in a Football game the movement of a Player is actually implemented using Trees by moving in huge number of nodes beside each other this technique makes the player's movement more flexible .
Reputation Points: 14
Solved Threads: 1
Light Poster
Ahmed_I is offline Offline
32 posts
since Nov 2008
Feb 12th, 2009
0

Re: Stacks and trees

are trees implemented in the minesweeper game? if yes, then how?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
JONZ is offline Offline
9 posts
since Sep 2008
Feb 12th, 2009
0

Re: Stacks and trees

Click to Expand / Collapse  Quote originally posted by JONZ ...
are trees implemented in the minesweeper game? if yes, then how?
I don't think so, since the Mine Sweeper will use two Dimensional array as a Data Structure to assign a random number of mines in random cells.

But i think tress can be used implicitly by implementing recursive functions.

That's my thoughts .
Reputation Points: 14
Solved Threads: 1
Light Poster
Ahmed_I is offline Offline
32 posts
since Nov 2008
Feb 12th, 2009
0

Re: Stacks and trees

Ya I too agree with Ahmed_I that Minesweeper just uses a two dimensional array with mines generated at random.
Then a program is run which takes the present cell co-ordinates and calculates number of mines in all adjoining cells and writes a number equal to number of mines around it.

The later part of clicking and all can be done through some other methods.
Reputation Points: 485
Solved Threads: 88
Posting Pro
csurfer is offline Offline
564 posts
since Jan 2009
Feb 14th, 2009
0

Re: Stacks and trees

I just read a while ago that trees can be implemented in some boardgames..can you give me some board games where trees are implemented?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
JONZ is offline Offline
9 posts
since Sep 2008
Feb 14th, 2009
0

Re: Stacks and trees

Click to Expand / Collapse  Quote originally posted by JONZ ...
I just read a while ago that trees can be implemented in some boardgames..can you give me some board games where trees are implemented?
Well SCRABBLE would be the best example I suppose.When the computer plays with its set of letters it branches out and tries all possibilities to make a word which is there in the process of branching and trying for new words trees are used... Because they would be the best way to try out things.
Reputation Points: 485
Solved Threads: 88
Posting Pro
csurfer is offline Offline
564 posts
since Jan 2009
Feb 14th, 2009
0

Re: Stacks and trees

Checkers would be a good example. It would be a decent way to make an "AI" for it. Use trees to see all possible outcomes of a certain move, compare that with all the other outcomes to see the best move. (adding a limitation on the depth of analysis might be appropriate for speed/difficulty purposes)
Reputation Points: 128
Solved Threads: 43
Posting Whiz
death_oclock is offline Offline
389 posts
since Apr 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Alternative to ShellExecute
Next Thread in C Forum Timeline: Reading values from a file in C





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC