Guys please help me to find this

I am very new to the development side. Please help me to find the answer for this question. If possible please explain me how to do this.

The following simple bit of C# code creates an ArrayList.

It then adds a number of “BoxesOfWidgets” to the ArrayList, adding Widgets within each box.

The method GetRidOfTheSmallWidgets is meant to get rid of all of the widgets with lengths less than 20. Please add the code into this method to search through the ArrayList of boxes, and remove the small widgets from them.

You may not use foreach loops, iterators, or any other loop construct that is language specific.

Re: Guys please help me to find this

Put code in [code] tags. Ok, so you're almost there. Surely, you can up the logic to do this. You've managed to get this far. What algorithm have you come up with?

Hai,

Thanks for the reply first. Actually I am a undergraduate student. This is the test. I am a basic learner of .net. I tried to this much. But i dont know how to do it without for loop and iterations concept.

Re: Guys please help me to find this

Posted 27 April 2012 - 03:25 AM

blackcompe, on 27 April 2012 - 12:51 AM, said:

They're testing your knowledge of recursion. Try and come up with a solution or some psuedocode at least.

First Arraylist is colBoxesOfWidgets
colBoxesOfWidgets.Add(new BoxOfWidgets("Cardboard"));- This line Adds a new BoxOfWidget item
'CardBoard' and also adds a new Arraylist called colWidgets
The subequent lines add items in the new arraylist colWidgets
so the stucture of the arraylist is
In the 0th location of Arraylist colBoxesOfWidgets there is a new arraylist colWidgets where colwidgets
contains items Cardbox,blue widget,red widget,silver widget etc
In the 1st location of Arraylist colBoxesOfWidgets there is a new arraylist colWidgets where colwidgets
contains items metal,gold widget,orange widget,pink widget etc
Same with the 2nd location as well