Assignment # 4: Please Do Not Copy The Code From Others
Assignment # 4: Please Do Not Copy The Code From Others
List Implementation
A simple list can be implemented using arrays. To declare a list, we will use following
statements:
At any moment, the current status of the list can be inspected using a variable ‘count’. We
declare this variable as a global so that it can reflect the current situation of the list to every
module of the program.
count
Deleting an Element from the List
Case 1: When there is no element in the list i.e.
if(count == 0)
3. Replace the value of given position with the value of next position
4. Repeat (3) until end of the list (count - 1) is reached.
5. Decrement the value of the count variable.
if(count >= 1)
sortList(list);
else
cout<<”List is EMPTY”<<endl;
if(count == 0)
cout<<”List is EMPTY”<<endl;
else
reverseList(List,size);
Or