Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The diagram in Figure 1 represents nodes that store students scores in ascending order. A) Define the struct definition of the Linked List node in

The diagram in Figure 1 represents nodes that store students scores in ascending order.

image text in transcribed

A) Define the struct definition of the Linked List node in Figure 1. Name the structure as Nodestruct which consist of data as integer and next as a pointer.

B) Given the following ADT for the linked list in Figure 1:

class ScoreData {

public:

const ListType& operator= (const listType);

bool isEmptyList() const;

void display();

int length() const;

void destroyList();

Type front() const;

Type back() const;

void insert_inorderlist(const Type & newdata);

void deleteData (Type& deletedata);}

b1) Show the definition of the constructor and destructor.

b2) Declare the data member of class ScoreData under private member for pointer First and Last.

b3) Declare a variable named number_element under private member to store the number of elements in the list.

C) Show a complete function display() to display all data in the linkedlist.

D) Show a complete function insert_inorderlist() to insert data in ascending order into the linkedlist.

You must consider the following cases:

  • use pointer named current to traverse the list
  • use pointer named before to point before the current node
  • The list is initially empty
  • The new data is smaller than the smallest data in the list
  • The item to be inserted somewhere in the list
  • The new data is larger than all data in the list

#To be implemented as a dynamic linked list.

First 75 80 84 93 Last Figure 1

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

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

Define the one-person-band syndrome.

Answered: 1 week ago

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago