Question: Q4.(40 pts) (using Cpp only) Declare a node struct with 2 member variables: integer data and a pointer next which reference to another node a.

Q4.(40 pts) (using Cpp only)

Declare a node struct with 2 member variables: integer data and a pointer next which reference to another node

a. (5 pts) Create a singly linked list sorted in increasing order that contains n nodes (n input from keyboard), each node get random data within the range [-1010]

b. (5 pts) Write a function to output a given linked list

c. (10 pts) Break a given list into 2 separate lists: one contains all negative integers, and the other contains positive integers (include 0)

d. (10 pts) Find the integer values that have the highest occurrences in the list

e. (10 pts) Remove all duplicates from the list

Q4.(40 pts)

Declare a node struct with 2 member variables: integer data and a pointer next which reference to another node

a. (5 pts) Create a singly linked list sorted in increasing order that contains n nodes (n input from keyboard), each node get random data within the range [-1010]

b. (5 pts) Write a function to output a given linked list

c. (10 pts) Break a given list into 2 separate lists: one contains all negative integers, and the other contains positive integers (include 0)

d. (10 pts) Find the integer values that have the highest occurrences in the list

e. (10 pts) Remove all duplicates from the list

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!