Submitted by heartin on Wed, 11/11/2015 - 09:35
Approach
-
In inorder, we print data and then go to left and right subtree.
-
We can use a stack here.
-
Every time we print a node, we will add its right and left children to the stack in order.
-
Since stack is a LIFO data structure, the left will be poped and printed first.
Solution
void preorder(TreeNode n)
{
TreeNode current = n;
Stack s = new Stack();
s.push(current);
while(!s.isEmpty())
Submitted by heartin on Wed, 11/11/2015 - 08:33
Approach
We can use a stack data structure to do this:
Submitted by heartin on Tue, 11/10/2015 - 03:18
In the previous lab we created the web service with an annotation @XmlType with attribute propOrder on top of Employee class to define order of field elements.
Submitted by heartin on Tue, 11/10/2015 - 03:03
We can use JAXB annoatations to specify the XML element names within the SOAP request and response.
JAXB will be making use of your default constructor and setters/getters. Remember to give a default constructor for your class in case you are having parameterized constrcutors.
Submitted by heartin on Mon, 11/09/2015 - 23:14
In JAXB2, annotations are used both in generated Java content classes and in Java classes as input to generate schema definitions.
These binding annotations are defined in the javax.xml.bind.annotation package.
Below are some of the more commonly used annotations defined in the javax.xml.bind.annotation package.
-
XmlAccessorType
Pages