Skip to content

reimplementing some C++ STL containers which includes Vector ( array as base data structure) Map and Set (Red Black Tree as base data structure) and Stack (Vector as base data structure )

Notifications You must be signed in to change notification settings

ytouate/1337-FT_CONTAINERS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents
  1. About The Project
  2. Roadmap
  3. Resources

About The Project

Screen Shot 2023-01-09 at 7 55 16 PM

FT_CONTAINERS is a project I've worked on during my studies at 1337 the purpose of the project is to reimplement three of the most used CPlusPlus STL containers (or four if you want to do the bonus part).

the three containers are

  • one sequence container vector
  • one sequence container adapter stack
  • one associative container map
  • another associative container set (in bonus part)

- UTILITIES FOR THE VECTOR

  • Random access iterator to traverse the container
  • enable_if and is_integral are used in some methods that require dealing with input iterators and integers

- UTILITIES FOR THE MAP

  • a red-black tree class that implements most of the methods in the map container
  • bidirectional_iterator to traverse the map
  • a pair class to hold the value of the node in the tree

- COMMON UTILITIES

  • lexicographical_compare and equal template functions are used in relational operators of the containers
  • reverse_iterator template class to reverse a given iterator passed to it



Roadmap

if I had to retry the project I would've avoided lots of mistakes I did during my implementation of the containers these are my tips for each container.

Vector

  • if you implemented a well-tested method of the vector try to use it in the other methods
  • write a method for managing the capacity of the vector that treats all the cases
  • focus on writing fast code and keep your file organized
  • if at some point you need a temporary array use your vector instead

Map

  • write a battle-tested tree class that uses the allocator properly and implements all the methods of the map

  • once you're done with the tree start implementing the tree iterator which is gonna be bidirectional if your iterator, const_iterator, reverse_iterator, and const_reverse_iterator are functioning you can pass them to the map

  • at this point the map is easy you just create the constructors and keep calling the _tree corresponding method whenever you needed

COMMON TIPS

  • most of the testers test the time complexity of your container so try to optimize your code as much as you can
  • divide your code just like if norminette exists
  • Don't try to create your tree algorithms the insert, delete, and search methods exists understand how they work and use them don't get overwhelmed

Resources

About

reimplementing some C++ STL containers which includes Vector ( array as base data structure) Map and Set (Red Black Tree as base data structure) and Stack (Vector as base data structure )

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published