educative.io

Graph Implementation -does the code even run?

I tried to copy/paste the code into my IDE and even with repeated fixes the code does not compile.
Major problem is the “linkedList”? Should it not be “LinkedList”? What is the method “insertAtHead”?
After spending an hour to fix the code, I realized that this code is based on the earlier implementation of “linkedList” from the previous topic.
Well, in real life, if I am asked to implement a BFS algorithm, I am not going to be using my own implementation of a linked list. I will Java’s in-built LinkedList. This code is of no use to me…

Hi Sanjana_B,

This is Arqam from Educative. We are really happy to hear from you.

We expect from the users to take this course from the start. In this way, the user will have a better understanding of each and every data structure through out the course.
If your approach is to pick some random topics then it means you have an understanding of all the prerequisites data structures. Moreover, if you are trying to solve the problem on your own IDE using built-in data structures then you can share your code if you get any challenges. Our team is always here for you to help out with every problem.

If you are really in favor of using your own IDE and built-in data structures then you can use it and test your code on the Educative platform. You can compare your algorithm with the provided algorithm.

We are also in the phase of revamping the course. Soon, we will make each and every chapter independent from each other.

Thank you again.

Regards,

Arqam Rehan | Developer Advocate

1 Like