Skip to content

Commit 09851b3

Browse files
added data structure conversion
1 parent e21e1bd commit 09851b3

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

public/data/cpp.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,38 @@
6060
"author": "saminjay"
6161
}
6262
]
63+
},{
64+
"categoryName":"Data Structure Conversion",
65+
"snippets":[
66+
{
67+
"title":"Vector to Set",
68+
"description":"Converts a vector to a set.",
69+
"code":[
70+
"#include <vector>",
71+
"#include <set>",
72+
"",
73+
"std::set<int> vectorToSet(const std::vector<int>& vec) {",
74+
" return std::set<int>(vec.begin(), vec.end());",
75+
"}"
76+
],
77+
"tags":["cpp","vector","set","conversion","utility"],
78+
"author":"mrityunjay2003"
79+
},
80+
{
81+
"title":"Vector to Queue",
82+
"description":"Converts a vector to a queue.",
83+
"code":[
84+
"#include <vector>",
85+
"#include <queue>",
86+
"#include<deque>",
87+
"",
88+
"std::queue<int> vectorToQueue(const std::vector<int>& v) {",
89+
" return std::queue<int>(std::deque<int>(v.begin(), v.end()));",
90+
"}"
91+
],
92+
"tags":["cpp","queue","vector","conversion","utility"],
93+
"author":"mrityunjay2003"
94+
}
95+
]
6396
}
6497
]

0 commit comments

Comments
 (0)