Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 19d136a

Browse files
chore: use iwyu on search/**.cpp
1 parent 5dd7f82 commit 19d136a

File tree

6 files changed

+24
-29
lines changed

6 files changed

+24
-29
lines changed

search/exponential_search.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212
* algorithm return null ponter, every other cases the algoritm return fom the
1313
* loop.
1414
*/
15-
#include <cassert>
16-
#include <cmath>
17-
#include <cstdint>
18-
#include <cstdint> /// for integral typedefs
15+
#include <cassert> // for assert
16+
#include <cmath> // for floor
17+
#include <cstdint> // for int32_t, uint32_t
1918
#ifdef _MSC_VER
2019
#include <string> // use for MS Visual C++
2120
#else
22-
#include <cstring> // for all other compilers
21+
#include <cstring> // for size_t
2322
#endif
2423

2524
/** Binary Search Algorithm (used by ::struzik_search)\n

search/fibonacci_search.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
* algorithm](https://en.wikipedia.org/wiki/Fibonacci_search_technique)
66
*/
77

8-
#include <iostream>
9-
#include <vector> // for std::vector class
10-
#include <cassert> // for assert
11-
#include <cstdlib> // for random numbers
12-
#include <algorithm> // for sorting
8+
#include <vector> // for vector
9+
#include <cassert> // for assert
10+
#include <cstdlib> // for rand
11+
#include <algorithm> // for find, sort, min, remove
1312

1413

1514

search/hash_search.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,14 @@
1515
* @todo fix the program for memory leaks and better structure in C++ and not C
1616
* fashion
1717
*/
18-
#include <cstdlib>
19-
#include <iostream>
18+
#include <cstdlib> // for NULL, malloc
19+
#include <iostream> // for basic_ostream, operator<<, char_traits, basic_os...
2020

2121
#define MAX 6 ///< Determines how much data
2222
#define HASHMAX 5 ///< Determines the length of the hash table
2323

2424
int data[MAX] = {1, 10, 15, 5, 8, 7}; //!< test data
2525

26-
/**
27-
* a one-way linked list
28-
*/
29-
typedef struct list {
3026
int key; //!< key value for node
3127
struct list* next; //!< pointer to next link in the chain
3228
} node, /**< define node as one item list */

search/saddleback_search.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
*
1313
* @author [Hashir Niazi](https://github.com/HashirGJ8842)
1414
*/
15-
#include <cassert> /// for assert
16-
#include <cstdint> /// for integral typedefs
17-
#include <iostream> /// for io operations, and std::pair
18-
#include <vector> /// for std::vector
15+
#include <cassert> // for assert
16+
#include <cstdint> // for uint32_t, int32_t
17+
#include <vector> // for vector
18+
#include <utility> // for pair, make_pair, operator==
1919

2020
/** \namespace search
2121
* \brief Algorithms for searching

search/sublist_search.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@
2525
* @author [Nitin Sharma](https://github.com/foo290)
2626
*/
2727

28-
#include <cassert> /// for assert
29-
#include <cstdint> /// for integral typedefs
30-
#include <iostream> /// for IO operations
31-
#include <vector> /// for std::vector
28+
#include <cassert> // for assert
29+
#include <cstddef> // for NULL
30+
#include <cstdint> // for uint64_t, uint32_t
31+
#include <iostream> // for basic_ostream, operator<<, cout, char_traits, endl
32+
#include <vector> // for vector
3233

3334
/**
3435
* @namespace search

search/text_search.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
* \file
33
* \brief Search for words in a long textual paragraph.
44
*/
5-
#include <cassert>
6-
#include <cstdlib>
7-
#include <iostream>
5+
#include <ctype.h> // for tolower
6+
#include <cassert> // for assert
7+
#include <iostream> // for basic_ostream, operator<<, char_traits, cout, endl
8+
#include <string> // for basic_string, operator<<, string, getline
89
#ifdef _MSC_VER
9-
#include <string> // required for MS Visual C++
10+
#include <string> // for basic_string, operator<<, string, getline
1011
#else
11-
#include <cstring>
1212
#endif
1313

1414
/**

0 commit comments

Comments
 (0)