kvarnerexpress 0 Report post Posted September 12, 2005 I am confused at how to make a linked list using recursion. I've been looking at the syntax and examples from the web for the past couple hours, but all seem to be based on an empty .java file. I need to put it in my code somehow. here's the code segment: public static boolean RecursiveTest (String s, int start, Node n) {// The linked listNode<char> bracket = new Node<char>();int size = s.length();char v = s.charAt(start);//String sElement = parens.top();boolean isGood = true;// ending "ifs"if (size == 0) { System.out.println("empty string"); return false; }if (start == size) return isGood;if (s.charAt(start) == '(' || s.charAt(start) == '[' ||s.charAt(start)== '{') {v.Push(sChar);System.out.println(sChar);return RecursiveTest(start+1, s.charAt(start));}else if (sChar.equals(")") && sElement.equals("(")) {parens.Pop();System.out.println(sChar);return RecursiveTest(start+1);}else if (sChar.equals("]") && sElement.equals("[")) {parens.Pop();System.out.println(sChar);return RecursiveTest(start+1);}else if (sChar.equals("}") && sElement.equals("{")) {parens.Pop();System.out.println(sChar);return RecursiveTest(start+1);}else if (sChar.equals(")") && !sElement.equals("(")) {System.out.println("bad");isGood = false;return isGood;}else if (sChar.equals("]") && !sElement.equals("[")) {System.out.println("bad");isGood = false;return isGood;}else if (sChar.equals("}") && !sElement.equals("{")) {System.out.println("bad");isGood = false;return isGood;}else return RecursiveTest(start+1);} // end of RecursiveTest I'm passing a string, 0, and a new node (i dunno about the last one there), from an above main class.This code is wrong, i know, but it's all I got done so far. How would I be able to make a linked list inside this method?NOTE: the Push() and Pop() are remnants from copy-paste from my stack method above that uses the same if and else-if statements. I need to replace them with the correct code for a working linked listThanks,kvarnerexpress Share this post Link to post Share on other sites