1. Discussions based on course 5 and „Data structures” course

In this laboratory we will discuss and make exercises about:

  • Data structures of simple linked list, double linked list, stack and queue types.
  • Static implementation(using arrays) of stack, queue type data structures etc.
  • Dynamic implementation (using linked lists) of stack, queue type data structures etc.
  • etc

2. Exercises

  1. Write a C++ function that adds a value to the end of a simple linked list.
  2. Write a C++ function that displays the values of a simple linked list.
  3. Write a C++ function which determines the sum of odd elements in a simple linked list that are situated between two even elements.
  4. Write a C++ function that adds a value to the beginning of a simple linked list.
  5. Write a C++ function that deletes the first element of a simple linked list.
  6. Write a C++ function which determines how many pairs of coprime numbers are in a simple linked list.
  7. Write a C++ function which inserts a certain value before a given element from a simple linked list.
  8. Write a C++ function which inserts after every even element, in a simple linked list, its double.
  9. Write a C++ function which determines how many elements exist in a simple linked list.
  10. Write a C++ function which determines ho many pairs of equal consecutive numbers exist in a simple linked list.
  11. Write a C++ function which deletes from a simple linked list, an element positioned after a given element.
  12. Write a C++ function which deletes from a simple linked list, a given element.
  13. Write a C++ function which deletes all the even elements from a simple linked list.
  14. Write a C++ function which inserts a certain value after a given element from a simple linked list.
  15. Write a C++ function which inserts before every even number of a simple linked list, its double.
  16. Write a C++ function which sorts ascending the elements of a simple linked list.
  17. Verify if a simple linked list forms a palindrome.
  18. Write a program which manages a stack of integer numbers. Initially, the stack is void. The program will read a list of operations, which can be:
    • push X – adds the integer value X on stack;
    • pop – remove the top element of the stack;
    • top – display the top element of the stack. The program will perform the operations on the stack, in order. The displays will be made on each line.