We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Well, let me explain my approach back then (it's been two years since I made this code):
A hash table was used to quickly find out if the item existed in the list and there was a double-linked list to keep the relative order of the keys (whichever they had).
Because If you were asked to find a value in a doubly linked list (especially a large one), it would not be a good idea to go through the list to find it, a solution seemed to use a Hash table to find the value (I am aware that this could vary depending on the problem) and this would make it more efficient in speed (not so in space used, of course).
Sorry for my late response.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Abstract Classes - Polymorphism
You are viewing a single comment's thread. Return to all comments →
Well, let me explain my approach back then (it's been two years since I made this code):
Because If you were asked to find a value in a doubly linked list (especially a large one), it would not be a good idea to go through the list to find it, a solution seemed to use a Hash table to find the value (I am aware that this could vary depending on the problem) and this would make it more efficient in speed (not so in space used, of course).
Sorry for my late response.