Welcome to our forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Forum Statistics

  • Forum Members:
  • Total Threads:
  • Total Posts: 3
There are 1 users currently browsing forums.
C and C++ Programming C and C++ are both robust and hugely popular programming languages that are used in multiple facets of programming, ranging from games to operating systems to simple text editors. To dicuss and seek advice, ask around here.

Reply
  #1  
Old 11-07-2009
New Born
 
Join Date: Nov 2009
Posts: 1
Rep Power: 0
petrossi is on a distinguished road
help in c!!!

hi everybody,
i am a new in c and i need your help.
I have to make a sparse array (insert, delete, print). Every node must have 4 pointer(up, down,left,right). Then this array i want to change to a tree with breadth first search algorithm. i am ok with the first part(sparse array)but i can't understand how i'll make bfs algorithm. i searched in the internet and all i found was in pascal. please help me.
Thanks!!!!
Reply With Quote
  #2  
Old 11-08-2009
vento's Avatar
Sexy monkey
 
Join Date: May 2009
Location: Lithuania
Age: 16
Posts: 185
Rep Power: 1
vento is on a distinguished road
Re: help in c!!!

Well, that's not so hard to translate the algorithm. I remember I used this algorithm last year, but I haven't got it on my computer, sorry.

Well, what's the problem with it? Do you understand how it works? If yes, what's the problem? It looks pretty simple for me? Maybe your array is not the way you can use in this algorithm? The idea of this algorithm is that you go into the first node, mark it as checked, then select connected nodes to visit on the next loop (probably a vector would be nice for this).
Another, simpler way to do so (and I think that was the way I did last year) is to make a loop from 0 to N-1 (N - a number of nodes, N-1 because the arrays starts at 0) and make another loop in it, which finds the first node, which is not visited and is supposed to be visited. (I had to find the shortest way, so I checked if the way to the node is shorter than the one that exists already.
__________________

How to set up portable C++ IDE (Dev-C++)

Writing in C or C++ is like running a chain saw with all the safety guards removed," — Bob Gray.
Reply With Quote
  #3  
Old 11-13-2009
Child
 
Join Date: Jun 2008
Posts: 89
Rep Power: 2
tossy is on a distinguished road
Re: help in c!!!

Hey, I have tried its not problem .....its easy to use.
Reply With Quote


Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On