Stack and Queues Browser History Upgrade
Здравейте, може ли някой да погледне тези два кода и да ми кажа, защо с единия взимам 100/100 а с другия 50/100, пропускам нещо.
correct: https://pastebin.com/9dpfKsya
incorrect: https://pastebin.com/5wGJ3gL9
Ps : няма проверка за първия else
Условие:
1.Browser History Upgrade
Extend "Browser History" with a "forward" instruction which visits URLs that were navigated away from by "back"
Each forward instruction visits the next most-recent such URL. If a normal navigation happens, all potential forward URLs are removed until a new back instruction is given If the forward instruction can’t be executed, print
"no next URLs".
Examples
Input |
Output |
forward https//softuni.bg/ https//softuni.bg/trainings/courses https//softuni.bg/trainings/2056 back back forward forward https//softuni.bg/trainings/courses Home |
no next URLs https//softuni.bg/ https//softuni.bg/trainings/courses https//softuni.bg/ https//softuni.bg/trainings/courses https//softuni.bg/trainings/2056 https//softuni.bg/trainings/courses https//softuni.bg/trainings/2056 no next URLs https//softuni.bg/trainings/courses |
Hints
- Use the solution from Browser History
- Use ArrayDequeue<> as queue to keep the forward pages
- Use clear() method to reset the forward pages
- Use addFirst() when adding page to the forward pages
Явно да хаха. Благодаря!