## Delete last occurrence of an item from linked list

Given a liked list and a key to be deleted. Delete last occurrence of key from linked. The list may have duplicates. Examples: Input: 1->2->3->5->2->10, key = 2 Output: 1->2->3->5->10 We strongly recommend you to minimize your browser and try this yourself first The idea is to traverse the linked list from beginning to end.… Read More »

See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.

In Java, LinkedList class implements the list interface. This class consists of the following methods : 1. boolean add(Object element) : It appends the element to the end of the list. 2. void add(int index, Object element): It inserts the element at the position ‘index’ in the list. 3. void addFirst(Object element) : It inserts… Read More »

See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.

## Delete a Linked List node at a given position

Given a singly linked list and a position, delete a linked list node at the given position.

See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.

## Insertion Sort for Singly Linked List

We have discussed Insertion Sort for arrays. In this article same for linked list is discussed. Below is simple insertion sort algorithm for linked list. 1) Create an empty sorted (or result) list 2) Traverse the given list, do following for every node. ……a) Insert current node in sorted way in sorted or result list.… Read More »

See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.

## Search an element in a Linked List (Iterative and Recursive)

Write a C function that searches a given key ‘x’ in a given singly linked list. The function should return true if x is present in linked list and false otherwise.

See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.

## Find Length of a Linked List (Iterative and Recursive)

Write a C function to count number of nodes in a given singly linked list. For example, the function should return 5 for linked list 1->3->1->2->1.

See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.