Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Q. Write down the non-recursive algorithm to traverse a tree in preorder. Ans:
Q. Write down the non-recursive algorithm to traverse a tree in preorder.
Ans:
The Non- Recursive algorithm for preorder traversal is written below: Initially in the begnining push NULL onto stack and then set PTR=Root. Keep on repeating the following steps until PTR= NULL. 1. Preorder down the left most paths routed at the PTR. 2. Processing each node N on the path and pushing each right child if there is onto the stack.[The traversing will stop when (PTR)=NULL] 3. Backtracking: pop and assign to PTR the top element on stack. If PTR is not equal to NULL then return to step 1 otherwise it exits.
The Non- Recursive algorithm for preorder traversal is written below: Initially in the begnining
push NULL onto stack and then set PTR=Root. Keep on repeating the following steps until PTR= NULL.
1. Preorder down the left most paths routed at the PTR.
2. Processing each node N on the path and pushing each right child if there is onto the stack.[The traversing will stop when (PTR)=NULL]
3. Backtracking: pop and assign to PTR the top element on stack. If PTR is not equal to NULL then return to step 1 otherwise it exits.
Write down any four applications of the queues. Ans. A pp li cation of Queue is given below (i) Queue is
Relation between the time and space complexities of an algorithm The examining of algorithm focuses on time complexity and space complexity. As compared to time analysis, the a
Mid Square method with good example
What is Keyed Access- Container A collection may allow its elements to be accessed by keys. For instance, maps are unstructured containers which allows their elements to be
Big oh notation (O) : The upper bound for the function 'f' is given by the big oh notation (O). Considering 'g' to be a function from the non-negative integers to the positive real
Depth-first traversal A depth-first traversal of a tree visit a node and then recursively visits the subtrees of that node. Likewise, depth-first traversal of a graph visits
The Euclidean algorithm is an algorithm to decide the greatest common divisor of two positive integers. The greatest common divisor of N and M, in short GCD(M,N), is the largest in
Circular Queues:- A more efficient queue representation is get by regarding the array Q(1:n) as circular. It becomes more convenient to declare the array as Q(O: n-1), when re
Program: Creation of a Circular linked list ALGORITHM (Insertion of an element into a Circular Linked List) Step 1 Begin Step 2 if the list is empty or new
Enumerate the Types in Ruby Ruby is a pure object-oriented language, meaning that all types in Ruby are classes, and each value in a Ruby program is an instance of a class. Thi
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd