Check if the singly Linked List is a Palindrome

preview_player
Показать описание
Given a linked List , check if the lisnked list is a palindrome or not. Write a program.
Рекомендации по теме
Комментарии
Автор

Your videos are of great help and the language you use is so simple and understandable.Thanks.

vatsalanand
Автор

These are great series of videos! I'm glad I came across them.

One suggestion -- at the end of the videos, could you also discuss the space and time complexity for your algorithms? Thanks and keep 'em coming!

farazromani
Автор

When p is null, p->next will throw null pointer at this line on even length check :- if(p ->next == NULL)

TechTanka
Автор

It throws nullpointer exception in the even case, because p is already null and your trying to access p.next()

anweshvalleshetti
Автор

We can also use stack to determine whether it's a palindrome or not.

ProgrammingTutorialsM
Автор

I came here looking for cooper and I found gold

sergiojimenez
Автор

Amazing !!Effort for us .Huge respect bro

rishabhsahu
Автор

Would you please make an example of copy constructor in the Linked List in C++? Thanks

VanTran-zfmg
Автор

Mr. Vivekananda ji, try to make videos on hashing

pankushmahajan
Автор

seriously dude this is really good .appreciate it

uzairkhurshid
Автор

Your program will "Crash" in the second scenario (for Even Number of Elements of Linked List)
--> At the last Iteration when "P" becomes a NULL, and your try to access the data from P->Next --> Result in Crash as there is no any address of P.
You need to modify the if statement as follows:

Option1:
if(p->next == NULL) -- Modify to --> if(p && p->next == NULL)

Option2:
swap the positions of both the "if" statements and the second if statement would be an "else if" rather than just "if".

Thanks!

ProgrammingArena
Автор

It's a Null pointer exception for this test case: [1, 0, 1] . The when we have to assign secondStart = q.next.next, it will point to Null

rohankrishna
Автор

This was asked in my Nvidia experienced software interview. Please make more videos.

satvikkhare
Автор

Or you could add all the elements to stack<Nodes> and then check half the LinkedList: time is O(n).... but space is O(n)

koeber
Автор

The point is finding middle node. The solution is creating a race condition. One pointer's velocity must be two times bigger than other pointer's velocity. When faster pointer reaches the end, other pointer will be in the middle.

I prefer recursive way. I will find the middle by recursively then start comparing from middle nodes(even or odd problem also here) then by returning next node to upper recursive iteration and comparing prev node and returned next node and so on..

cemyasar
Автор

The first IF condition in while loop "if(p.next == null)" should be "if(p != null && p.next == null)"

shailbenq
Автор

Your videos are very great can you please upload videos on dynamic programming problems like gold mining, tiling problem

HarshKumar-nhbe
Автор

Thanks for the wonderful video.... Please take a look into the first "if" condition, as many mentioned in the comments.... Thanks!!!! :)

informative_idiot-xe
Автор

in even linked list if p is nul lthe statement p->next will give segmentation fault because pointer pointing to non existing locaton

palagatideepthireddy
Автор

sir could you please make a video on XOR linked list, SKIP list, UNROLLED list..

rflxplays