# Category Archives: ACM

## Swap without a temp variable

It’s also possible with multiplication:

## Bellman Ford

It works on negative cycle.

Implemented Code:

Time Complexity:

O([E].[V])

## Dijkstra

output:

Complexity:
O(E+V^2)

We are using here adjacency matrix list

## Topological Sort

code:

Output:

Time Complexity: O(V+E)
Space Complexity: O(V)
V for vertex E for edge

code courtesy:

Topological Sorting

I understood the theory but need to understand the code well later

## HackerEarth: Batman and Tick-tack-toe

This is a basic implementaation problem but need to think critically and I used editorial + previous solved code to understand the logic

code:

## Bucket Sort

Pseudocode:

Implemented Code:

output:

Tuts:

Bucket Sort

Harumanchi Book implementation:

output:

Time and Space complexity: O(n)

best video:

pseudocode:

implementation: (I need to clear the radix sort part later..took help to implement)

Reference:

Radix Sort – Explanation, Pseudocode and Implementation

Time complexity: O(d*n)==O(n)
Where d is the digit of the number

## Counting Sort

Algo:

Implemented Code:

Counting Sort in C

Tuts:

Complexity:
Time: O(k)+O(n)+O(k)+O(n)=O(n) if K=O(n)
Space: O(n)

code:

code:

## Traversal in Binary Search Tree

Height of a binary tree:

Level Order BFS in Binary Search Tree:

output:

DFS in Preorder, Inorder, Postorder:

output: