Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Entity Alignment Concepts Recent Advances And Novel Approaches

Authors: Xiang Zhao ,Weixin Zeng ,Jiuyang Tang

1st Edition

9819942527, 978-9819942527

More Books

Students also viewed these Databases questions

Question

Identify the elements that make up the employee reward package.

Answered: 1 week ago

Question

Understand the purpose, value and drawbacks of the interview.

Answered: 1 week ago