listing continued string br readline()return //public static int getint(throws ioexception string getstring()return integer parseint( )///end class stacktriangle app here two short while loops in the stacktriangle(method substitute for the entire step(method of the stacktriangle java program of coursein this program you can see by inspection that you can eliminate the stack entirely and use simple loop howeverin more complicated algorithms the stack must remain often you'll need to experiment to see whether recursive methoda stack-based approachor simple loop is the most efficient (or practicalway to handle particular situation some interesting recursive applications let' look briefly at some other situations in which recursion is useful you will see from the diversity of these examples that recursion can pop up in unexpected places we'll examine three problemsraising number to powerfitting items into knapsackand choosing members of mountain-climbing team we'll explain the concepts and leave the implementations as exercises raising number to power the more sophisticated pocket calculators allow you to raise number to an arbitrary power they usually have key labeled something like ^ywhere the circumflex indicates that is raised to the power how would you do this calculation if your calculator lacked this keyyou might assume you would need to multiply by itself times that isif was and was ( )you would carry out the arithmetic for * * * * * * * howeverfor large values of ythis approach might prove tedious is there quicker wayone solution is to rearrange the problem so you multiply by multiples of whenever possibleinstead of by take as an example eventuallywe must involve eight in the multiplication process let' say we start with * = we've used up two of the