diff --git a/annotated.html b/annotated.html index 4aeeef877..c86c6b941 100644 --- a/annotated.html +++ b/annotated.html @@ -231,26 +231,27 @@ $(document).ready(function(){initNavTree('annotated.html',''); initResizable();  Clarge_number  Clinkedlist  Clist - CMinHeap - CMinHeapNode - Cmst - CNode - Cnode - CPoint - Cquery - CQueue - Cqueue - CRBtree - CSegmentIntersection - CSolution - Cstack - Cstack_linkedList - CTestCasesClass encapsulating the necessary test cases - Ctower - CTrie - CTrieNode - Cuint128_tClass for 128-bit unsigned integer - Cuint256_tClass for 256-bit unsigned integer + CListNodeFor IO operations + CMinHeap + CMinHeapNode + Cmst + CNode + Cnode + CPoint + Cquery + CQueue + Cqueue + CRBtree + CSegmentIntersection + CSolution + Cstack + Cstack_linkedList + CTestCasesClass encapsulating the necessary test cases + Ctower + CTrie + CTrieNode + Cuint128_tClass for 128-bit unsigned integer + Cuint256_tClass for 256-bit unsigned integer diff --git a/annotated_dup.js b/annotated_dup.js index f214c271a..754f526d9 100644 --- a/annotated_dup.js +++ b/annotated_dup.js @@ -167,6 +167,7 @@ var annotated_dup = [ "large_number", "db/d82/classlarge__number.html", "db/d82/classlarge__number" ], [ "linkedlist", "d0/dff/structlinkedlist.html", null ], [ "list", "d8/d10/structlist.html", "d8/d10/structlist" ], + [ "ListNode", "d7/da4/struct_list_node.html", "d7/da4/struct_list_node" ], [ "MinHeap", "d2/d05/class_min_heap.html", "d2/d05/class_min_heap" ], [ "MinHeapNode", "d5/d29/struct_min_heap_node.html", null ], [ "mst", "d1/d77/structmst.html", null ], diff --git a/classes.html b/classes.html index 17d3661ad..fab929aff 100644 --- a/classes.html +++ b/classes.html @@ -131,7 +131,7 @@ $(document).ready(function(){initNavTree('classes.html',''); initResizable(); })
AyStarSearch::Info (machine_learning::aystar_search)
is_arithmetic< uint128_t > (std)
is_arithmetic< uint256_t > (std)
is_integral< uint128_t > (std)
is_integral< uint256_t > (std)
is_unsigned< uint128_t > (std)
is_unsigned< uint256_t > (std)
Item
L
-
large_number
link (data_structures::linked_list)
linkedlist
list (data_structures::linked_list)
list (data_structures::list_array)
list
LowestCommonAncestor (graph)
LRUCache (others::lru_cache)
+
large_number
link (data_structures::linked_list)
linkedlist
list (data_structures::linked_list)
list (data_structures::list_array)
list
ListNode
LowestCommonAncestor (graph)
LRUCache (others::lru_cache)
M
MinHeap
MinHeapNode
mst
diff --git a/d0/d77/linear__search_8cpp__incl.map b/d0/d77/linear__search_8cpp__incl.map index 0bba9b36b..30c5a72f3 100644 --- a/d0/d77/linear__search_8cpp__incl.map +++ b/d0/d77/linear__search_8cpp__incl.map @@ -1,5 +1,5 @@ - - + + diff --git a/d0/d77/linear__search_8cpp__incl.md5 b/d0/d77/linear__search_8cpp__incl.md5 index 692f05ae1..78c42da32 100644 --- a/d0/d77/linear__search_8cpp__incl.md5 +++ b/d0/d77/linear__search_8cpp__incl.md5 @@ -1 +1 @@ -b46ee7444fc9b9a06b87423dbda65bef \ No newline at end of file +f739def1df22364220bc39188a1f29b2 \ No newline at end of file diff --git a/d0/d77/linear__search_8cpp__incl.svg b/d0/d77/linear__search_8cpp__incl.svg index f9b125222..ac76ff9bb 100644 --- a/d0/d77/linear__search_8cpp__incl.svg +++ b/d0/d77/linear__search_8cpp__incl.svg @@ -21,8 +21,8 @@ Node2 - -iostream + +cassert @@ -36,8 +36,8 @@ Node3 - -cassert + +iostream diff --git a/d5/d1b/struct_list_node__coll__graph.map b/d5/d1b/struct_list_node__coll__graph.map new file mode 100644 index 000000000..c4dbe59d7 --- /dev/null +++ b/d5/d1b/struct_list_node__coll__graph.map @@ -0,0 +1,3 @@ + + + diff --git a/d5/d1b/struct_list_node__coll__graph.md5 b/d5/d1b/struct_list_node__coll__graph.md5 new file mode 100644 index 000000000..f0934db9a --- /dev/null +++ b/d5/d1b/struct_list_node__coll__graph.md5 @@ -0,0 +1 @@ +a61e2a1cf94de25ca1d7c242b5208091 \ No newline at end of file diff --git a/d5/d1b/struct_list_node__coll__graph.svg b/d5/d1b/struct_list_node__coll__graph.svg new file mode 100644 index 000000000..b620dd55a --- /dev/null +++ b/d5/d1b/struct_list_node__coll__graph.svg @@ -0,0 +1,28 @@ + + + + + + +ListNode + + +Node1 + + +ListNode + + + + + +Node1->Node1 + + + next + + + diff --git a/d5/d88/md__d_i_r_e_c_t_o_r_y.html b/d5/d88/md__d_i_r_e_c_t_o_r_y.html index e2512edcc..37e411ef8 100644 --- a/d5/d88/md__d_i_r_e_c_t_o_r_y.html +++ b/d5/d88/md__d_i_r_e_c_t_o_r_y.html @@ -459,6 +459,7 @@ Search
  • Jump Search
  • Linear Search
  • Median Search
  • +
  • Median Search2
  • Saddleback Search
  • Sublist Search
  • Ternary Search
  • diff --git a/d7/da4/struct_list_node.html b/d7/da4/struct_list_node.html new file mode 100644 index 000000000..d6948ce48 --- /dev/null +++ b/d7/da4/struct_list_node.html @@ -0,0 +1,159 @@ + + + + + + + +Algorithms_in_C++: ListNode Struct Reference + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Algorithms_in_C++ 1.0.0 +
    +
    Set of algorithms implemented in C++.
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    ListNode Struct Reference
    +
    +
    + +

    for IO operations + More...

    +
    +Collaboration diagram for ListNode:
    +
    +
    +
    +
    [legend]
    + + + + + + + + + + + +

    +Public Member Functions

    ListNode ()=default
     default constructor
     
    ListNode (int x)
     constructor with value for node->val provided
     
    ListNode (int x, ListNode *next)
     constructor with values provided for node->val and node->next
     
    + + + + + + + +

    +Public Attributes

    +int val {0}
     the value stored in the node
     
    +ListNodenext {nullptr}
     pointer to the next node
     
    +

    Detailed Description

    +

    for IO operations

    +

    for assert Definition for singly-linked list.

    +

    The documentation for this struct was generated from the following file: +
    +
    + + + + diff --git a/d7/da4/struct_list_node.js b/d7/da4/struct_list_node.js new file mode 100644 index 000000000..f90d9b242 --- /dev/null +++ b/d7/da4/struct_list_node.js @@ -0,0 +1,8 @@ +var struct_list_node = +[ + [ "ListNode", "d7/da4/struct_list_node.html#a3cfee2eb667c332dc32595208164ef0a", null ], + [ "ListNode", "d7/da4/struct_list_node.html#aaad9b553e2f936726f5b35ff2734125d", null ], + [ "ListNode", "d7/da4/struct_list_node.html#afc97c5b9d2e7cc82d0718245688f6ff9", null ], + [ "next", "d7/da4/struct_list_node.html#ad78b392c2ddc25c3243d0c2f30692fb1", null ], + [ "val", "d7/da4/struct_list_node.html#a58389d1d1fc5430c2f4ce7c5d5dc48b3", null ] +]; \ No newline at end of file diff --git a/d8/dfa/median__search2_8cpp.html b/d8/dfa/median__search2_8cpp.html new file mode 100644 index 000000000..1314da438 --- /dev/null +++ b/d8/dfa/median__search2_8cpp.html @@ -0,0 +1,325 @@ + + + + + + + +Algorithms_in_C++: search/median_search2.cpp File Reference + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Algorithms_in_C++ 1.0.0 +
    +
    Set of algorithms implemented in C++.
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    median_search2.cpp File Reference
    +
    +
    + +

    Given a linked list L[0,....,n] of n numbers, find the middle node. +More...

    +
    #include <cassert>
    +#include <iostream>
    +
    +Include dependency graph for median_search2.cpp:
    +
    +
    +
    +
    +
    + + + + +

    +Classes

    struct  ListNode
     for IO operations More...
     
    + + + + + + + +

    +Namespaces

    namespace  search
     for std::vector
     
     
    + + + + + + + + + +

    +Functions

    ListNodesearch::median_search2::middleNode (ListNode *head)
     
    static void test ()
     Self-test implementations. More...
     
    int main ()
     Main function. More...
     
    +

    Detailed Description

    +

    Given a linked list L[0,....,n] of n numbers, find the middle node.

    +

    The technique utilized in this implementation is the ["Floyd's +tortoise and +hare"](https://en.wikipedia.org/wiki/Cycle_detection#Floyd's_tortoise_and_hare) approach. This technique uses two pointers that iterate through the list at different 'speeds' in order to solve problems. In this implementation, for every iteration the slow pointer advances one node while the fast pointer advances two nodes. The result of this is that since the fast pointer moves twice as fast as the slow pointer, when the fast pointer reaches the end of the list the slow pointer will be pointing to the middle node of the list.

    +

    Here are some example lists you can use to see how the algorithm works A = [1,2,3,4,5] B = [1,2,3,4,5,6] print median(A) #should be 39 print median(B) #should be 4

    +
    Author
    Benjamin Weiss
    +
    See also
    median_search.cpp
    +

    Function Documentation

    + +

    ◆ main()

    + +
    +
    + + + + + + + + +
    int main (void )
    +
    + +

    Main function.

    +
    Returns
    0 on exit
    +
    136 {
    +
    137 test(); // run self-test implementations
    +
    138 return 0;
    +
    139}
    +
    static void test()
    Self-test implementations.
    Definition: median_search2.cpp:83
    +
    +Here is the call graph for this function:
    +
    +
    +
    +
    + +
    +
    + +

    ◆ middleNode()

    + +
    +
    + + + + + + + + +
    ListNode * search::median_search2::middleNode (ListNodehead)
    +
    +

    This function searches for the median of a linked list.

    Parameters
    + + +
    headThe head of the linked list.
    +
    +
    +
    Returns
    Median node of the linked list.
    +
    59 {
    +
    60 if (!head) {
    +
    61 return nullptr;
    +
    62 }
    +
    63
    +
    64 // Fast and slow pointers
    +
    65 ListNode* fastptr = nullptr;
    +
    66 ListNode* slowptr = fastptr = head;
    +
    67
    +
    68 // fast jumps 2 while slow jumps 1
    +
    69 while (fastptr->next && fastptr->next->next) {
    +
    70 slowptr = slowptr->next;
    +
    71 fastptr = fastptr->next->next;
    +
    72 }
    +
    73
    +
    74 return (fastptr->next) ? slowptr->next : slowptr;
    +
    75}
    +
    for IO operations
    Definition: median_search2.cpp:31
    +
    ListNode * next
    pointer to the next node
    Definition: median_search2.cpp:33
    +
    +Here is the call graph for this function:
    +
    +
    +
    +
    + +
    +
    + +

    ◆ test()

    + +
    +
    + + + + + +
    + + + + + + + +
    static void test ()
    +
    +static
    +
    + +

    Self-test implementations.

    +
    Returns
    void
    +
    83 {
    +
    84 auto* head1 = new ListNode;
    +
    85 head1->val = 1;
    +
    86
    +
    87 ListNode* temp = head1;
    +
    88 for (int i = 2; i < 6; ++i) {
    +
    89 // Allocate next
    +
    90 auto* temp1 = new ListNode;
    +
    91 temp1->val = i;
    +
    92
    +
    93 // Advance
    +
    94 temp->next = temp1;
    +
    95 temp = temp1;
    +
    96 }
    +
    97 temp->next = nullptr;
    +
    98
    + +
    100 assert(3 == median->val); // 3 is the value of the median node.
    +
    101 std::cout << "test case:1 passed\n";
    +
    102
    +
    103 // Test case # 2
    +
    104 auto* head2 = new ListNode;
    +
    105 head2->val = 1;
    +
    106
    +
    107 ListNode* temp2 = head2;
    +
    108 for (int i = 2; i < 7; ++i) {
    +
    109 // Allocate next
    +
    110 auto* temp3 = new ListNode;
    +
    111 temp3->val = i;
    +
    112
    +
    113 // Advance
    +
    114 temp2->next = temp3;
    +
    115 temp2 = temp3;
    +
    116 }
    +
    117 temp2->next = nullptr;
    +
    118
    + +
    120 assert(4 == median1->val); // 4 is the value of the median node.
    +
    121 std::cout << "test case:2 passed\n";
    +
    122
    +
    123 delete head1;
    +
    124 delete temp;
    +
    125
    +
    126 delete head2;
    +
    127 delete temp2;
    +
    128
    +
    129 std::cout << "--All tests passed--\n";
    +
    130}
    + +
    ListNode * middleNode(ListNode *head)
    Definition: median_search2.cpp:59
    +
    int val
    the value stored in the node
    Definition: median_search2.cpp:32
    +
    +
    +
    +
    +
    + + + + diff --git a/d8/dfa/median__search2_8cpp.js b/d8/dfa/median__search2_8cpp.js new file mode 100644 index 000000000..b42cd83e2 --- /dev/null +++ b/d8/dfa/median__search2_8cpp.js @@ -0,0 +1,7 @@ +var median__search2_8cpp = +[ + [ "ListNode", "d7/da4/struct_list_node.html", "d7/da4/struct_list_node" ], + [ "main", "d8/dfa/median__search2_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ], + [ "middleNode", "d8/dfa/median__search2_8cpp.html#a5fefe132a0c3ee780ebc703f37ebce6a", null ], + [ "test", "d8/dfa/median__search2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d", null ] +]; \ No newline at end of file diff --git a/d8/dfa/median__search2_8cpp_a5fefe132a0c3ee780ebc703f37ebce6a_cgraph.map b/d8/dfa/median__search2_8cpp_a5fefe132a0c3ee780ebc703f37ebce6a_cgraph.map new file mode 100644 index 000000000..a0bc2014e --- /dev/null +++ b/d8/dfa/median__search2_8cpp_a5fefe132a0c3ee780ebc703f37ebce6a_cgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/d8/dfa/median__search2_8cpp_a5fefe132a0c3ee780ebc703f37ebce6a_cgraph.md5 b/d8/dfa/median__search2_8cpp_a5fefe132a0c3ee780ebc703f37ebce6a_cgraph.md5 new file mode 100644 index 000000000..4680bb440 --- /dev/null +++ b/d8/dfa/median__search2_8cpp_a5fefe132a0c3ee780ebc703f37ebce6a_cgraph.md5 @@ -0,0 +1 @@ +f3c711422d7b7dcc578a15cde9ac4f18 \ No newline at end of file diff --git a/d8/dfa/median__search2_8cpp_a5fefe132a0c3ee780ebc703f37ebce6a_cgraph.svg b/d8/dfa/median__search2_8cpp_a5fefe132a0c3ee780ebc703f37ebce6a_cgraph.svg new file mode 100644 index 000000000..fe739307a --- /dev/null +++ b/d8/dfa/median__search2_8cpp_a5fefe132a0c3ee780ebc703f37ebce6a_cgraph.svg @@ -0,0 +1,28 @@ + + + + + + +search::median_search2::middleNode + + +Node1 + + +search::median_search2 +::middleNode + + + + + +Node1->Node1 + + + + + diff --git a/d8/dfa/median__search2_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/d8/dfa/median__search2_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map new file mode 100644 index 000000000..1443f7a5b --- /dev/null +++ b/d8/dfa/median__search2_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/d8/dfa/median__search2_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/d8/dfa/median__search2_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 new file mode 100644 index 000000000..30171c2ce --- /dev/null +++ b/d8/dfa/median__search2_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -0,0 +1 @@ +865843294b099986015985f7c8068eb3 \ No newline at end of file diff --git a/d8/dfa/median__search2_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/d8/dfa/median__search2_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg new file mode 100644 index 000000000..553d27d9b --- /dev/null +++ b/d8/dfa/median__search2_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -0,0 +1,36 @@ + + + + + + +main + + +Node1 + + +main + + + + + +Node2 + + +test + + + + + +Node1->Node2 + + + + + diff --git a/d9/d02/linear__search_8cpp.html b/d9/d02/linear__search_8cpp.html index 26a2700b4..b3d7458c8 100644 --- a/d9/d02/linear__search_8cpp.html +++ b/d9/d02/linear__search_8cpp.html @@ -105,8 +105,8 @@ $(document).ready(function(){initNavTree('d9/d02/linear__search_8cpp.html','../.

    Linear search algorithm More...

    -
    #include <iostream>
    -#include <cassert>
    +
    #include <cassert>
    +#include <iostream>
    Include dependency graph for linear_search.cpp:
    @@ -117,7 +117,7 @@ Include dependency graph for linear_search.cpp:

    Functions

    int LinearSearch (int *array, int size, int key) - for assert More...
    + for IO operations More...
      static void tests ()  Self-test implementations. More...
    @@ -164,8 +164,8 @@ Functions
    -

    for assert

    -

    for IO operations

    +

    for IO operations

    +

    for assert

    [Algorithm implementation for linear search]

    Parameters
    @@ -177,18 +177,17 @@ Functions
    Returns
    index where the key-value occurs in the array
    -1 if key-value not found
    -
    22{
    -
    23 for (int i = 0; i < size; ++i)
    -
    24 {
    -
    25 if (array[i] == key)
    -
    26 {
    -
    27 return i;
    -
    28 }
    -
    29 }
    -
    30
    -
    31 /* We reach here only in case element is not present in array, return an invalid entry in that case*/
    -
    32 return -1;
    -
    33}
    +
    21 {
    +
    22 for (int i = 0; i < size; ++i) {
    +
    23 if (array[i] == key) {
    +
    24 return i;
    +
    25 }
    +
    26 }
    +
    27
    +
    28 /* We reach here only in case element is not present in array, return an
    +
    29 * invalid entry in that case*/
    +
    30 return -1;
    +
    31}
    @@ -210,59 +209,52 @@ Functions

    Main function.

    Returns
    0 on exit
    -
    71{
    -
    72 int mode = 0;
    -
    73
    -
    74 std::cout << "Choose mode\n";
    -
    75 std::cout << "Self-test mode (1), interactive mode (2): ";
    -
    76
    -
    77 std::cin >> mode;
    -
    78
    -
    79 if (mode == 2)
    -
    80 {
    -
    81 int size = 0;
    -
    82 std::cout << "\nEnter the size of the array [in range 1-30 ]: ";
    -
    83 std::cin >> size;
    -
    84
    -
    85 while (size <= 0 || size > 30){
    -
    86 std::cout << "Size can only be 1-30. Please choose another value: ";
    -
    87 std::cin >> size;
    -
    88 }
    -
    89
    -
    90 int *array = new int[size];
    -
    91 int key = 0;
    -
    92
    -
    93 // Input for the array elements
    -
    94 std::cout << "Enter the array of " << size << " numbers: ";
    -
    95 for (int i = 0; i < size; i++)
    -
    96 {
    -
    97 std::cin >> array[i];
    -
    98 }
    -
    99
    -
    100 std::cout << "\nEnter the number to be searched: ";
    -
    101 std::cin >> key;
    -
    102
    -
    103 int index = LinearSearch(array, size, key);
    -
    104 if (index != -1)
    -
    105 {
    -
    106 std::cout << "Number found at index: " << index << "\n";
    -
    107 }
    -
    108 else
    -
    109 {
    -
    110 std::cout << "Array element not found";
    -
    111 }
    -
    112 delete[] array;
    -
    113 }
    -
    114 else
    -
    115 {
    -
    116 tests(); // run self-test implementations
    -
    117 }
    -
    118 return 0;
    -
    119}
    +
    65 {
    +
    66 int mode = 0;
    +
    67
    +
    68 std::cout << "Choose mode\n";
    +
    69 std::cout << "Self-test mode (1), interactive mode (2): ";
    +
    70
    +
    71 std::cin >> mode;
    +
    72
    +
    73 if (mode == 2) {
    +
    74 int size = 0;
    +
    75 std::cout << "\nEnter the size of the array [in range 1-30 ]: ";
    +
    76 std::cin >> size;
    +
    77
    +
    78 while (size <= 0 || size > 30) {
    +
    79 std::cout << "Size can only be 1-30. Please choose another value: ";
    +
    80 std::cin >> size;
    +
    81 }
    +
    82
    +
    83 int *array = new int[size];
    +
    84 int key = 0;
    +
    85
    +
    86 // Input for the array elements
    +
    87 std::cout << "Enter the array of " << size << " numbers: ";
    +
    88 for (int i = 0; i < size; i++) {
    +
    89 std::cin >> array[i];
    +
    90 }
    +
    91
    +
    92 std::cout << "\nEnter the number to be searched: ";
    +
    93 std::cin >> key;
    +
    94
    +
    95 int index = LinearSearch(array, size, key);
    +
    96 if (index != -1) {
    +
    97 std::cout << "Number found at index: " << index << "\n";
    +
    98 } else {
    +
    99 std::cout << "Array element not found";
    +
    100 }
    +
    101 delete[] array;
    +
    102 } else {
    +
    103 tests(); // run self-test implementations
    +
    104 }
    +
    105 return 0;
    +
    106}
    -
    static void tests()
    Self-test implementations.
    Definition: linear_search.cpp:39
    -
    int LinearSearch(int *array, int size, int key)
    for assert
    Definition: linear_search.cpp:21
    +
    static void tests()
    Self-test implementations.
    Definition: linear_search.cpp:37
    +
    int LinearSearch(int *array, int size, int key)
    for IO operations
    Definition: linear_search.cpp:21
    Here is the call graph for this function:
    @@ -297,31 +289,29 @@ Here is the call graph for this function:

    Self-test implementations.

    Returns
    void
    -
    40{
    -
    41 int size = 4;
    -
    42 int *array = new int[size];
    -
    43 for (int i = 0; i < size; i++)
    -
    44 {
    -
    45 array[i] = i;
    -
    46 }
    +
    37 {
    +
    38 int size = 4;
    +
    39 int *array = new int[size];
    +
    40 for (int i = 0; i < size; i++) {
    +
    41 array[i] = i;
    +
    42 }
    +
    43
    +
    44 assert(LinearSearch(array, size, 0) == 0);
    +
    45 assert(LinearSearch(array, size, 1) == 1);
    +
    46 assert(LinearSearch(array, size, 2) == 2);
    47
    -
    48 assert(LinearSearch(array, size, 0) == 0);
    -
    49 assert(LinearSearch(array, size, 1) == 1);
    -
    50 assert(LinearSearch(array, size, 2) == 2);
    -
    51
    -
    52 size = 6;
    -
    53 for (int i = 0; i < size; i++)
    -
    54 {
    -
    55 array[i] = i;
    -
    56 }
    -
    57
    -
    58 assert(LinearSearch(array, size, 3) == 3);
    -
    59 assert(LinearSearch(array, size, 1) == 1);
    -
    60 assert(LinearSearch(array, size, 5) == 5);
    -
    61
    -
    62 std::cout << "All tests have successfully passed!\n";
    -
    63 delete[] array; // free memory up
    -
    64}
    +
    48 size = 6;
    +
    49 for (int i = 0; i < size; i++) {
    +
    50 array[i] = i;
    +
    51 }
    +
    52
    +
    53 assert(LinearSearch(array, size, 3) == 3);
    +
    54 assert(LinearSearch(array, size, 1) == 1);
    +
    55 assert(LinearSearch(array, size, 5) == 5);
    +
    56
    +
    57 std::cout << "All tests have successfully passed!\n";
    +
    58 delete[] array; // free memory up
    +
    59}
    Here is the call graph for this function:
    diff --git a/d9/d02/linear__search_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.map b/d9/d02/linear__search_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.map index dd7b5a149..b7897a1ef 100644 --- a/d9/d02/linear__search_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.map +++ b/d9/d02/linear__search_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.map @@ -1,4 +1,4 @@ - + diff --git a/d9/d02/linear__search_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.md5 b/d9/d02/linear__search_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.md5 index 5e29e5fb9..1b6f797bd 100644 --- a/d9/d02/linear__search_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.md5 +++ b/d9/d02/linear__search_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.md5 @@ -1 +1 @@ -8e167eb7ed51cca6a14983245e3243f0 \ No newline at end of file +7c0362a48f00d4a688d2e0de27ba7644 \ No newline at end of file diff --git a/d9/d02/linear__search_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.svg b/d9/d02/linear__search_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.svg index 73cbeb130..5365a46b1 100644 --- a/d9/d02/linear__search_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.svg +++ b/d9/d02/linear__search_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.svg @@ -20,7 +20,7 @@ Node2 - + LinearSearch diff --git a/d9/d02/linear__search_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/d9/d02/linear__search_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map index 5b992827b..d1dd41109 100644 --- a/d9/d02/linear__search_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map +++ b/d9/d02/linear__search_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -1,5 +1,5 @@ - + diff --git a/d9/d02/linear__search_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/d9/d02/linear__search_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 index 5712c3350..3f607590b 100644 --- a/d9/d02/linear__search_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 +++ b/d9/d02/linear__search_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -1 +1 @@ -edc4f4310f479483b258ffeee895f81d \ No newline at end of file +c1b2a027f30fe0899c9b31934d074824 \ No newline at end of file diff --git a/d9/d02/linear__search_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/d9/d02/linear__search_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg index 7c4b7e5c1..4e2e025cb 100644 --- a/d9/d02/linear__search_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg +++ b/d9/d02/linear__search_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -20,7 +20,7 @@ Node2 - + LinearSearch diff --git a/d9/d73/median__search2_8cpp__incl.map b/d9/d73/median__search2_8cpp__incl.map new file mode 100644 index 000000000..8ce1918eb --- /dev/null +++ b/d9/d73/median__search2_8cpp__incl.map @@ -0,0 +1,5 @@ + + + + + diff --git a/d9/d73/median__search2_8cpp__incl.md5 b/d9/d73/median__search2_8cpp__incl.md5 new file mode 100644 index 000000000..f87e7a141 --- /dev/null +++ b/d9/d73/median__search2_8cpp__incl.md5 @@ -0,0 +1 @@ +3b2aa67abc4a7a6dbc0ec06089a024a2 \ No newline at end of file diff --git a/d9/d73/median__search2_8cpp__incl.svg b/d9/d73/median__search2_8cpp__incl.svg new file mode 100644 index 000000000..7e523ab66 --- /dev/null +++ b/d9/d73/median__search2_8cpp__incl.svg @@ -0,0 +1,51 @@ + + + + + + +search/median_search2.cpp + + +Node1 + + +search/median_search2.cpp + + + + + +Node2 + + +cassert + + + + + +Node1->Node2 + + + + + +Node3 + + +iostream + + + + + +Node1->Node3 + + + + + diff --git a/da/dd4/namespacemedian__search.html b/da/dd4/namespacemedian__search.html index 766c0f099..4644318d6 100644 --- a/da/dd4/namespacemedian__search.html +++ b/da/dd4/namespacemedian__search.html @@ -105,6 +105,7 @@ $(document).ready(function(){initNavTree('da/dd4/namespacemedian__search.html',' More...

    Detailed Description

    Functions for Median search algorithm.

    +

    Functions for the Median Search algorithm implementation. Wkipedia link to algorithm: https://en.wikipedia.org/wiki/Median_search.

    diff --git a/dc/dec/struct_list_node-members.html b/dc/dec/struct_list_node-members.html new file mode 100644 index 000000000..40e8860eb --- /dev/null +++ b/dc/dec/struct_list_node-members.html @@ -0,0 +1,120 @@ + + + + + + + +Algorithms_in_C++: Member List + + + + + + + + + + + + + + + +
    +
    +
    [in]arrayarray to search in
    + + + + + +
    +
    Algorithms_in_C++ 1.0.0 +
    +
    Set of algorithms implemented in C++.
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    ListNode Member List
    +
    +
    + +

    This is the complete list of members for ListNode, including all inherited members.

    + + + + + + +
    ListNode()=defaultListNode
    ListNode(int x)ListNodeinlineexplicit
    ListNode(int x, ListNode *next)ListNodeinline
    nextListNode
    valListNode
    +
    + + + + diff --git a/dir_19b2bf9199a15c634a08b1ede1dd896a.html b/dir_19b2bf9199a15c634a08b1ede1dd896a.html index 4f3f3ec1a..a3d6f5e5d 100644 --- a/dir_19b2bf9199a15c634a08b1ede1dd896a.html +++ b/dir_19b2bf9199a15c634a08b1ede1dd896a.html @@ -127,6 +127,9 @@ Files file  median_search.cpp  Implementation of Median search algorithm. @cases from here
      +file  median_search2.cpp + Given a linked list L[0,....,n] of n numbers, find the middle node.
    +  file  saddleback_search.cpp  Implementation of Saddleback Algorithm for 2D arrays.
      diff --git a/dir_19b2bf9199a15c634a08b1ede1dd896a.js b/dir_19b2bf9199a15c634a08b1ede1dd896a.js index bd29d2e20..c5e502d18 100644 --- a/dir_19b2bf9199a15c634a08b1ede1dd896a.js +++ b/dir_19b2bf9199a15c634a08b1ede1dd896a.js @@ -8,6 +8,7 @@ var dir_19b2bf9199a15c634a08b1ede1dd896a = [ "jump_search.cpp", "d2/d22/jump__search_8cpp.html", "d2/d22/jump__search_8cpp" ], [ "linear_search.cpp", "d9/d02/linear__search_8cpp.html", "d9/d02/linear__search_8cpp" ], [ "median_search.cpp", "d9/d69/median__search_8cpp.html", "d9/d69/median__search_8cpp" ], + [ "median_search2.cpp", "d8/dfa/median__search2_8cpp.html", "d8/dfa/median__search2_8cpp" ], [ "saddleback_search.cpp", "d3/d22/saddleback__search_8cpp.html", "d3/d22/saddleback__search_8cpp" ], [ "sublist_search.cpp", "d5/d45/sublist__search_8cpp.html", "d5/d45/sublist__search_8cpp" ], [ "ternary_search.cpp", "dc/dfe/ternary__search_8cpp.html", "dc/dfe/ternary__search_8cpp" ], diff --git a/files.html b/files.html index f45c3a173..cd0d4bb33 100644 --- a/files.html +++ b/files.html @@ -347,10 +347,11 @@ N)\) time, with precision fixed using jump_search.cppC++ program to implement Jump Search  linear_search.cppLinear search algorithm  median_search.cppImplementation of Median search algorithm. @cases from here - saddleback_search.cppImplementation of Saddleback Algorithm for 2D arrays - sublist_search.cppImplementation of the Sublist Search Algorithm - ternary_search.cppTernary search algorithm - text_search.cppSearch for words in a long textual paragraph + median_search2.cppGiven a linked list L[0,....,n] of n numbers, find the middle node + saddleback_search.cppImplementation of Saddleback Algorithm for 2D arrays + sublist_search.cppImplementation of the Sublist Search Algorithm + ternary_search.cppTernary search algorithm + text_search.cppSearch for words in a long textual paragraph   sorting  binary_insertion_sort.cppBinary Insertion Sort Algorithm (Insertion Sort)  bogo_sort.cppImplementation of Bogosort algorithm diff --git a/functions_func_l.html b/functions_func_l.html index c48c2aab9..797aff31c 100644 --- a/functions_func_l.html +++ b/functions_func_l.html @@ -109,6 +109,7 @@ $(document).ready(function(){initNavTree('functions_func_l.html',''); initResiza
  • LinearSearch() : data_structures::list_array::list< N >
  • link() : data_structures::linked_list::link
  • list() : data_structures::linked_list::list
  • +
  • ListNode() : ListNode
  • load_model() : machine_learning::neural_network::NeuralNetwork
  • log() : TestCases
  • lower() : uint128_t, uint256_t
  • diff --git a/functions_l.html b/functions_l.html index fba071768..5541f5b8b 100644 --- a/functions_l.html +++ b/functions_l.html @@ -112,6 +112,7 @@ $(document).ready(function(){initNavTree('functions_l.html',''); initResizable()
  • LinearSearch() : data_structures::list_array::list< N >
  • link() : data_structures::linked_list::link
  • list() : data_structures::linked_list::list
  • +
  • ListNode() : ListNode
  • load_model() : machine_learning::neural_network::NeuralNetwork
  • LOG : data_structures::sparse_table::Sparse_table
  • log() : TestCases
  • diff --git a/functions_n.html b/functions_n.html index da0e58ced..7e21bdb35 100644 --- a/functions_n.html +++ b/functions_n.html @@ -107,7 +107,7 @@ $(document).ready(function(){initNavTree('functions_n.html',''); initResizable()
  • NeuralNetwork() : machine_learning::neural_network::NeuralNetwork
  • new_val() : statistics::stats_computer1< T >, statistics::stats_computer2< T >
  • newKid() : range_queries::perSegTree
  • -
  • next : data_structures::linked_list::Node, hash_chain, list, node< Kind >, operations_on_datastructures::circular_linked_list::Node, search::sublist_search::Node
  • +
  • next : data_structures::linked_list::Node, hash_chain, list, ListNode, node< Kind >, operations_on_datastructures::circular_linked_list::Node, search::sublist_search::Node
  • Node() : data_structures::Node, data_structures::tree_234::Node, hash_chain, operations_on_datastructures::circular_linked_list::Node, operations_on_datastructures::reverse_binary_tree::Node
  • NUM_CHARS : data_structures::trie
  • num_digits() : large_number
  • diff --git a/functions_v.html b/functions_v.html index efd265abb..f6354fde5 100644 --- a/functions_v.html +++ b/functions_v.html @@ -100,7 +100,7 @@ $(document).ready(function(){initNavTree('functions_v.html',''); initResizable()
    Here is a list of all documented class members with links to the class documentation for each member:

    - v -