Linked List Add definition of the following functions into a simply linked list: 1) Insert before tail: Insert a value into a simply linked list, such that it's location will be before tail. So if a list contains {1, 2, 3}, insert before tail value 9 is called, the list will become {1, 2, 9, 3}. 2) Insert before yalue: Insert a value into a simply linked list, such that it's location will be before a particular value. So if a list contains {1, 2, 3}, insert before 2 value 9 is called, the list will become {1, 9, 2, 3}. 3)Count common elements : Count common values between two simply linked lists. So if a list1 contains {1, 2, 3, 4, 5}, and list2 contains {1, 3, 4, 6}, number of common elements is 3. 4) Check if'sorted: Check if elements of simply linked lists are sorted in ascending order or not. So if a list contains {1, 3, 7, 8, 9} its sorted, but if a list contains {1, 3, 7, 2, 5} its not sorted. 5) Find sublist: Find and return sublist in a list, the start and stop positions indicate where the sublist starts and where it ends. So if a list contains {1, 3, 7, 8, 9}, sublist at start 2 and stop 4 is {3, 7, 8)

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 13PE
icon
Related questions
Question

Using C++ Programming :::

(Linked List) 

Linked List
Add definition of the following functions into a simply linked list:
1) Insert before tail: Insert a value into a simply linked list, such that it's location will be
before tail.
So if a list contains (1, 2, 3}, insert before tail value 9 is called, the list will become {1, 2, 9,
3}.
2) Insert before yalue: Insert a value into a simply linked list, such that it's location will be
before a particular value.
So if a list contains (1, 2, 3}, insert before 2 value 9 is called, the list will become {1, 9, 2,
3}.
3)Count common elements : Count common values between two simply linked lists.
So if a list1 contains (1, 2, 3, 4, 5}, and list2 contains {1, 3, 4, 6}, number of common
elements is 3.
4) Check if 'sorted: Check if elements of simply linked lists are sorted in ascending order
or not.
So if a list contains {1, 3, 7, 8, 9} its sorted, but if a list contains {1, 3, 7, 2, 5} its not sorted.
5) Find sublist: Find and return sublist in a list, the start and stop positions indicate where
the sublist starts and where it ends.
So if a list contains {1, 3, 7, 8, 9}, sublist at start 2 and stop 4 is {3, 7, 8)
Transcribed Image Text:Linked List Add definition of the following functions into a simply linked list: 1) Insert before tail: Insert a value into a simply linked list, such that it's location will be before tail. So if a list contains (1, 2, 3}, insert before tail value 9 is called, the list will become {1, 2, 9, 3}. 2) Insert before yalue: Insert a value into a simply linked list, such that it's location will be before a particular value. So if a list contains (1, 2, 3}, insert before 2 value 9 is called, the list will become {1, 9, 2, 3}. 3)Count common elements : Count common values between two simply linked lists. So if a list1 contains (1, 2, 3, 4, 5}, and list2 contains {1, 3, 4, 6}, number of common elements is 3. 4) Check if 'sorted: Check if elements of simply linked lists are sorted in ascending order or not. So if a list contains {1, 3, 7, 8, 9} its sorted, but if a list contains {1, 3, 7, 2, 5} its not sorted. 5) Find sublist: Find and return sublist in a list, the start and stop positions indicate where the sublist starts and where it ends. So if a list contains {1, 3, 7, 8, 9}, sublist at start 2 and stop 4 is {3, 7, 8)
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning