Sunday, July 4, 2021

DSA collections

1). Remove all adjacent duplicate character.
abbac: Input
ac : Output

Use stack.

2). find nth element of Febnocci number.
Use recursion

1 1 2 3 5 8 13 21..

3).print inverted Tree.

4). Police and Thief : 
How many max thieves can be cought?
(P T T P P P T P T P)

One P can catch only one Thief.
One police can catch a thief at a distance K.
K=1.

5).  Evaluate reverse police notation.

Use stack to push operand and then pop and do operations if operand is found.

6). Find and delete nth node from the end in the singly Linked List.

7). Merge two sorted Arrays.