summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-08-14 07:54:28 +0200
committerTyge Løvset <[email protected]>2020-08-14 07:54:28 +0200
commita3b7d48d5e9ee28751bb43297e8abdbd31778394 (patch)
treed541e2d77c1d6d74df3b8edda8e047ef0b963818 /examples
parent1aa7b8ff0952800ee26832f17dadf8a1a24d3848 (diff)
downloadSTC-modified-a3b7d48d5e9ee28751bb43297e8abdbd31778394.tar.gz
STC-modified-a3b7d48d5e9ee28751bb43297e8abdbd31778394.zip
Some cleanups.
Diffstat (limited to 'examples')
-rw-r--r--examples/geek4.c4
-rw-r--r--examples/geek5.c4
-rw-r--r--examples/geek6.c2
-rw-r--r--examples/geek7.c2
4 files changed, 7 insertions, 5 deletions
diff --git a/examples/geek4.c b/examples/geek4.c
index 3672563d..b0a57844 100644
--- a/examples/geek4.c
+++ b/examples/geek4.c
@@ -152,7 +152,9 @@ int main()
// C++ implementation of the approach
-#include <bits/stdc++.h>
+#include <unordered_map>
+#include <vector>
+#include <iostream>
using namespace std;
// Function to return the count of common words
diff --git a/examples/geek5.c b/examples/geek5.c
index cbfc40e6..67f5d097 100644
--- a/examples/geek5.c
+++ b/examples/geek5.c
@@ -37,7 +37,7 @@ int NumOccurrences(const char* arr[], int n, const char* str, int L, int R)
// If current string doesn't
// have an entry in the map
// then create the entry
- if (it == c_nullptr) {
+ if (it == NULL) {
cvec_i A = cvec_init;
cvec_i_push_back(&A, i + 1);
cmap_sv_put(&M, temp, A);
@@ -51,7 +51,7 @@ int NumOccurrences(const char* arr[], int n, const char* str, int L, int R)
// If the given string is not
// present in the array
- if (it == c_nullptr)
+ if (it == NULL)
return 0;
// If the given string is present
diff --git a/examples/geek6.c b/examples/geek6.c
index b3991e99..db0b3bcf 100644
--- a/examples/geek6.c
+++ b/examples/geek6.c
@@ -52,7 +52,7 @@ int missingNumber(int a[], int n)
// Return the first value starting
// from 1 which does not exists in map
while (1) {
- if (cset_i_find(&mp, index) == c_nullptr) {
+ if (cset_i_find(&mp, index) == NULL) {
return index;
}
diff --git a/examples/geek7.c b/examples/geek7.c
index 0976bf80..9a60c0a9 100644
--- a/examples/geek7.c
+++ b/examples/geek7.c
@@ -49,7 +49,7 @@ void findElementsAfterDel(int arr[], int m, int del[],
// Search if the element is present
cmap_ii_entry_t *e = cmap_ii_find(&mp, arr[i]);
- if (e != c_nullptr) {
+ if (e != NULL) {
// Decrement its frequency
e->value--;