Question: You will be required to implement one of three types of Linked List: Singly Linked List Doubly LinkedList Circular Linked List Your Linked List must

You will be required to implement one of three types of Linked List:

Singly Linked List

Doubly LinkedList

Circular Linked List

Your Linked List must be comprised of Nodes. A Node may be implemented as either a struct or a class, and must contain only pointers and the users data. Your Linked List must have a Head pointer, and may need a Tail pointer depending on the type. You may not use any of the containers or algorithms from the STL or Boost libraries in implementing your Linked List or its functionality.

FUNCTIONALITY

Output all data elements in their current order

Example:

  • Assume the linked list (singly, doubly or circular) contains the elements 10, 2, 3, 4, 5, 6 in that order
  • Outputting the elements should result in 10, 2, 3, 4, 5, 6 to be printed on the screen.

Sort all data elements in ascending or descending order using

  • Selection sort
  • Bubble sort
  • Insertion sort

Example:

  • Assume the linked list (singly, doubly or circular) contains the elements 10, 2, 3, 4, 5, 6

in that order

  • If the elements are to be sorted in ascending order then each of the sorting algorithms should result in a reordering of the elements in the linked list to 2,3,4,5,6,10
  • If the elements are to be sorted in descending order then each of the sorting algorithms should

result in a reordering of the elements in the linked list to 10, 6, 5, 4, 3, 2

Calculate and output the sum of every data element

Example:

  • Assume the linked list (singly, doubly or circular) contains the elements 10, 2, 3, 4, 5, 6

in that order

  • The value output should be 30 (10+2+3+4+5+6=30)

Calculate and output the sum of every second/third/fourth data element

Example:

  • Assume the linked list (singly, doubly or circular) contains the elements 10, 2, 3, 4, 5, 6

in that order

  • The sum of every second element: 12 (2+4+6=12)
  • The sum of every third element: 9 (3+6=9)
  • The sum of every fourth element: 4 (4=4)

Calculate and output the product of every data element

Example:

  • Assume the linked list (singly, doubly or circular) contains the elements 10, 2, 3, 4, 5, 6in that order
  • The value output is 7200 (10*2*3*4*5*6=7200)

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!