Solved

Non-recursive backtracking, using a stack

Posted on 2016-10-26
1
52 Views
Last Modified: 2016-11-08
Hi,

I was going through below link

http://www.cis.upenn.edu/~matuszek/cit594-2012/Pages/backtracking.html

what is difference between
Non-recursive backtracking, using a stack and
Non-recursive backtracking without using a stack

what is difference between
Non-recursive backtracking and recursive backtracking
please advise
0
Comment
Question by:gudii9
1 Comment
 
LVL 7

Accepted Solution

by:
James Bilous earned 500 total points
ID: 41860708
When you make recursive calls you are using a naturally occuring memory "call stack". This call stack is simply how your machine keeps track of functions that were previously called so that when you return, you can be placed back into the function where you left off. When you are using recursion to search a tree, you can exploit this naturally occuring stack to backtrack. Each recursive call to your function essentially keeps track of a single visit to a node in your tree.

When you don't use recursion, you have to use your own data structure called a Stack to emulate this behavior. The stack data structure will keep tabs of each node you visit rather than your function calls doing this for you in a recursive implementation.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Python Assistance 7 36
oracle query help 18 78
Currency Conversion? 1 39
Cipher Configuration on Apache HTTPD 4 24
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now