Need a project done?

C++ Programming Developer

Search This Blog

Showing posts with label sorting linked list alphabetically. Show all posts
Showing posts with label sorting linked list alphabetically. Show all posts

Sorting linked list in C++

Linked list has been sorted alphabetically in the following program.

struct pen{
char* color;
Int qty;
pen* link;
}
Q1. Using the above structure you are required to manage the linked list considering the
following rules.
Pen should be stored in alphabetical order.
* If you have two pens of color red and green, your linked list will be as follows:
head
* If you have 5 pens, Aqua, Green, Blue, Red and yellow, your linked list will be:
head
● Your program should display the menu:
Select your choice
1. Add Pen
2. Sell Pen
3. Display Stock
//------------------------------------------------------------------------------------------
Solution:
"Don't let anyone ever make you feel like you don't deserve what you want."