Question: So I have a problem where I basically have an arraylist or vector and each index in the vector contains the head to a linked

So I have a problem where I basically have an arraylist or vector and each index in the vector contains the head to a linked list. We originally organize this data by a certain attribute. Inserting isn't the hard part. Now we have a full vector and we need to regroup it based on a different attribute in each entry (or node in the linked list).

The regroup method is extremely hard and I am stuck, I'm wondering the best way to attack it with pseudo-code. Attached is a picture our professor made to show what is happeneing. Essentially we are just changing the next/prevs of the nodes

So I have a problem where I basically have an arraylist or

I'm not asking for someone to type any code as the solution, but maybe give me an idea in pseudo code such as:

create a copy of the vector;

iterate through this vector (going through each node in the linked list);

when you find a node, iterate again through the vector (going through each node again) and check to see if the grouping attribute is the same

if grouping attribute is the same change that node's next/prev to so and so

We aroe STREET bydefanH & Harvard St, Hrvar St 8alcon hst 37 Balcom icst 420a 20 EsEni, 14225 Now suppo poinher S+ 4204 4 201 420 in IP

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!