Learn basic concept of c , c++ and python programming in regularcodes.com
Print a linked list in to alternate first and last elements
Write an efficient algorithm to print a linked list in to alternate first and last elements.
Suppose linked list contain following nodes [1,2,3,4,5,6,7].
Output : 1 7 2 6 3 5 4
Program to print alternate first and last elements. Time complexity O(n).
Submit your solution in comment section.
- Program to find the number of elements in an array
- Decimal equivalent of binary linked list
- Level order traversal of a binary tree
- Level order traversal in spiral form
- Print all complete binary tree nodes
- Sum of right leaf nodes in binary tree
- Binary search tree print right view
- Lowest common ancestor of a binary search tree
- Copy Constructor in cpp