Skip to content

Tag Archives: Reverse

Given a string, that contains a special character together with alphabets (‘a’ to ‘z’ and ‘A’ to ‘Z’), reverse the string in a way that… Read More
Given an array arr[] and a position in array, k. Write a function name reverse (a[], k) such that it reverses subarray arr[0..k-1]. Extra space… Read More
Given a Perfect Binary Tree, reverse the alternate level nodes of the binary tree.  Given tree: a / \ b c / \ / \… Read More
Given a linked list, reverse alternate nodes and append them to the end of the list. Extra allowed space is O(1)  Examples:  Input: 1->2->3->4->5->6 Output:… Read More
We have discussed the level-order traversal of a tree in the previous post. The idea is to print the last level first, then the second… Read More
Given a linked list, write a function to reverse every alternate k nodes (where k is an input to the function) in an efficient way.… Read More
Given a linked list, write a function to reverse every k nodes (where k is an input to the function).  Example:  Input: 1->2->3->4->5->6->7->8->NULL, K =… Read More
Given a string, the task is to reverse the order of the words in the given string.  Examples: Input: s = “geeks quiz practice code” Output:… Read More
Write a program to reverse a stack using recursion, without using any loop. Example:  Input: elements present in stack from top to bottom 1 2… Read More