Category: Recursion

1

Find the n’th Node from the end of a given Linked List

Objective: Given a linked list and integer ‘n’, write an algorithm to find the nth node from the end in the Linked List. Example: Original List : ->1->2->8->3->7->0->4 Output : 3rd Element from the...

7

Reverse a Linked List

Objective: Reverse the given linked list. Input: A Linked List Output: Reversed Linked List Example: Input : ->30->25->20->15->10->5 Reversed : ->5->10->15->20->25->30 NOTE : Click Reverse a Linked List – Part 2 to see the...

1

Count All Paths from Top left to bottom right in Two Dimensional Array including Diagonal Paths

Objective: Count all the paths from left top corner to right bottom corner in two dimensional array. Input: Two Dimensional array Output: No of paths. Approach : 1. Recursive Recursive solution to this problem...

3

Print All Elements of Two Dimensional Array in Spiral

Objective: This question was asked in Amazon interview for the Software development Engineer position, Write an algorithm to print all the elements of two dimensional array in spiral. Example : Input: Two dimensional array...

3

Find Whether Given String is palindrome or Not.

Objective : Write an algorithm to find Whether Given String is palindrome or Not. Input:  A String, Output: true or false on whether string is palindrome or not Approach: Use recursive approach Compare first...

%d bloggers like this: