| .. | ||
| solution | ||
| CMakeLists.txt | ||
| list.cpp | ||
| README.md | ||
Linux compilation
> mkdir build
> cd build
> cmake -DCMAKE_BUILD_TYPE=Debug ..
> make
Valgrind usage
> valgrind valgrind_params path/to/binary binary_params, eg:
> valgrind --leak-check=full ./List
> or full output using command: valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind-out.txt ./List
Resource exapmle
Take a look at list.cpp file, where simple (and buggy) single-linked list is implemented.
pushFrontmethod adds a newNodeat the begining of the list.findByValuemethod iterates over the list and returns the first Node with matchingvalueornullptr.
- Compile and run List application
- Fix memory leaks without introducing smart pointers
- Fix memory leaks with smart pointers. What kind of pointers needs to be applied and why?
- Add function to add a node at the end of the list (try to do this with time complexity O(1))
- Add function to delete node with provided value.