Skip to content

Commit 46c8207

Browse files
added quick data structure conversion
1 parent 8e2e05c commit 46c8207

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Vector to Set
3+
description: Convert vector into set quickly
4+
tags: cpp, data structures,set,vector
5+
author: mrityunjay2003
6+
---
7+
8+
```cpp
9+
#include <vector>
10+
#include <set>
11+
12+
std::set<int> vectorToSet(const std::vector<int>& v) {
13+
return std::set<int>(v.begin(), v.end());
14+
}
15+
```
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: Vector to Queue
3+
description: Convert vector into queue quickly
4+
tags: cpp, data structures,queue,vector
5+
author: mrityunjay2003
6+
---
7+
8+
```cpp
9+
std::queue<int> vectorToQueue(const std::vector<int>& v) {
10+
return std::queue<int>(std::deque<int>(v.begin(), v.end()));
11+
}
12+
```

0 commit comments

Comments
 (0)