Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. Description:
You are given a Linkedlist you have to complete a function which will return the kth value from the end of that Linkedlist.
Question Name:
Kth Node From End Of Linked List
Question Link:
https://pepcoding.com/resources/onlin...
Question Statement:
1. You are given a partially written LinkedList class.
2. Here is a list of existing functions:
2.1 addLast - adds a new element with given value to the end of Linked List
2.2. display - Prints the elements of linked list from front to end in a single line.
All elements are separated by space.
2.3. size - Returns the number of elements in the linked list.
2.4. removeFirst - Removes the first element from Linked List.
2.5. getFirst - Returns the data of first element.
2.6. getLast - Returns the data of last element.
2.7. getAt - Returns the data of element available at the index passed.
2.8. addFirst - adds a new element with given value in front of linked list.
2.9. addAt - adds a new element at a given index.
2.10. removeLast - removes the last element of linked list.
2.11. removeAt - remove an element at a given index
3. You are required to complete the body of kthFromLast function. The function should be an iterative function and should return the kth node from end of linked list. Also, make sure to not use size data member directly or indirectly (by calculating size via making a traversal). k is a 0-based index. Assume that valid values of k will be passed.
4. Input and Output is managed for you.
5. For more detail watch the video.
Topic: #LinkedList
Used #DataStructure:
#TimeComplexity: O(N)
#SpaceComplexity: O(1)
--------------------------------------------------------------
Smimilar Questions:
1. Mid of Linkedlist :
a. Pepcoding Portal Link: https://pepcoding.com/resources/onlin...
---------------------------------------------------------------
More Youtube PlayList:
Level 1 In Java English : • Java Level 1 In English
Level 1 In Java Hindi : • DSA - Level 1
Level 2 In Java Hindi : • DSA - Level 2
Constructive Algorithm - Level 3 : • Constructive Algorithm - Level 3
Geometry - Level 3 : • Geometry Level 3
Maths for CP - Level 3 : • Maths For CP - Level 3
DP - Level 3 : • DP - Level 3
Euler Tour - Level 3 : • Euler Tour - Level 3
Ternary Search : • Ternary Search
Recursion & Backtracking - Level 1 : • Recursion & Backtracking - Level 1
Recursion & Backtracking - Level 2 : • Backtracking - Level 2
Graphs - Level 1 : • Graphs - Level 1
Dyanmic Programming - Level 1 : • Dynamic Programming - Level 1
Generic Trees - Level 1 : • Generic Trees - Level 1
Time and Space - Level 1 : • Time and Space - Level 1
---------------------------------------------------------------
Pepcoding has taken the initiative to provide counselling and learning resources to all curious, skillful and dedicated Indian coders. This video is part of the series to impart industry-level web development and programming skills in the community.
We also provide professional courses with live classes and placement opportunities.
For more visit our website: https://bit.ly/2ZCS68a
For more free study resources, visit: https://bit.ly/3liICaJ
Have a look at our result: https://bit.ly/2YcmDZR
Follow us on our Youtube page: / pepcoding
Follow us on our FB page: / pepcoding
Follow us on Instagram: / pepcoding
Follow us on LinkedIn: / pepcoding-education
Follow us on Pinterest: / _created
Follow us on Twitter: / pepcoding
.
.
.
Happy Programming !!! Pep it up
----------------------------------------------------------------
#LinkedList
=================================================================
Watch video Kth Node from end of Linkedlist | Linked Lists | In English | Java | Video_14 online, duration hours minute second in high quality that is uploaded to the channel Pepcoding 22 October 2021. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 78 times and liked it 1 visitors.