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
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 IPStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started