Purchase Solution

Writing a Function that Revises a List

Not what you're looking for?

Ask Custom Question

Imagine a circular linked list of integers that are sorted into ascending order as shown in the attached file.

The external pointer list points to the last node, which contains the largest integer.

Write a function that revises the list so that its data are sorted into descending order as shown in the attached file.

Do not allocate or deallocate nodes.

See attached file for diagrams.

Purchase this Solution

Solution Summary

This solution helps write a function that revises an external pointer list (of a circular list of integers sorted in ascending order) so that its data is sorted into descending order.

Solution Preview

Problem: Imagine a circular linked list of integers that are sorted into ascending order as shown in the attached file. The external pointer list points to the last node, which contains the largest integer. Write a function that revises the list so that its data are sorted into descending order as shown in the attached file. Do not allocate or deallocate nodes.

Solution:

Suppose for each node of the linked list, I have the following definition.
class Node {
int value; ...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Basic Networking Questions

This quiz consists of some basic networking questions.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.