Skip to content

Commit

Permalink
chore: use iwyu on search/**.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
realstealthninja committed Sep 13, 2024
1 parent 5dd7f82 commit 19d136a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 29 deletions.
9 changes: 4 additions & 5 deletions search/exponential_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
* algorithm return null ponter, every other cases the algoritm return fom the
* loop.
*/
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdint> /// for integral typedefs
#include <cassert> // for assert
#include <cmath> // for floor
#include <cstdint> // for int32_t, uint32_t
#ifdef _MSC_VER
#include <string> // use for MS Visual C++
#else
#include <cstring> // for all other compilers
#include <cstring> // for size_t
#endif

/** Binary Search Algorithm (used by ::struzik_search)\n
Expand Down
9 changes: 4 additions & 5 deletions search/fibonacci_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
* algorithm](https://en.wikipedia.org/wiki/Fibonacci_search_technique)
*/

#include <iostream>
#include <vector> // for std::vector class
#include <cassert> // for assert
#include <cstdlib> // for random numbers
#include <algorithm> // for sorting
#include <vector> // for vector
#include <cassert> // for assert
#include <cstdlib> // for rand
#include <algorithm> // for find, sort, min, remove



Expand Down
8 changes: 2 additions & 6 deletions search/hash_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,14 @@
* @todo fix the program for memory leaks and better structure in C++ and not C
* fashion
*/
#include <cstdlib>
#include <iostream>
#include <cstdlib> // for NULL, malloc
#include <iostream> // for basic_ostream, operator<<, char_traits, basic_os...

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

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

/**
* a one-way linked list
*/
typedef struct list {
int key; //!< key value for node
struct list* next; //!< pointer to next link in the chain
} node, /**< define node as one item list */
Expand Down
8 changes: 4 additions & 4 deletions search/saddleback_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
*
* @author [Hashir Niazi](https://github.com/HashirGJ8842)
*/
#include <cassert> /// for assert
#include <cstdint> /// for integral typedefs
#include <iostream> /// for io operations, and std::pair
#include <vector> /// for std::vector
#include <cassert> // for assert
#include <cstdint> // for uint32_t, int32_t
#include <vector> // for vector
#include <utility> // for pair, make_pair, operator==

/** \namespace search
* \brief Algorithms for searching
Expand Down
9 changes: 5 additions & 4 deletions search/sublist_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
* @author [Nitin Sharma](https://github.com/foo290)
*/

#include <cassert> /// for assert
#include <cstdint> /// for integral typedefs
#include <iostream> /// for IO operations
#include <vector> /// for std::vector
#include <cassert> // for assert
#include <cstddef> // for NULL
#include <cstdint> // for uint64_t, uint32_t
#include <iostream> // for basic_ostream, operator<<, cout, char_traits, endl
#include <vector> // for vector

/**
* @namespace search
Expand Down
10 changes: 5 additions & 5 deletions search/text_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* \file
* \brief Search for words in a long textual paragraph.
*/
#include <cassert>
#include <cstdlib>
#include <iostream>
#include <ctype.h> // for tolower
#include <cassert> // for assert
#include <iostream> // for basic_ostream, operator<<, char_traits, cout, endl
#include <string> // for basic_string, operator<<, string, getline
#ifdef _MSC_VER
#include <string> // required for MS Visual C++
#include <string> // for basic_string, operator<<, string, getline
#else
#include <cstring>
#endif

/**
Expand Down

0 comments on commit 19d136a

Please sign in to comment.