csemod 0.0.3__tar.gz → 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {csemod-0.0.3 → csemod-0.0.4}/PKG-INFO +1 -1
- {csemod-0.0.3 → csemod-0.0.4}/csemod/content.py +50 -0
- {csemod-0.0.3 → csemod-0.0.4}/csemod.egg-info/PKG-INFO +1 -1
- {csemod-0.0.3 → csemod-0.0.4}/setup.cfg +1 -1
- {csemod-0.0.3 → csemod-0.0.4}/setup.py +1 -1
- {csemod-0.0.3 → csemod-0.0.4}/README.md +0 -0
- {csemod-0.0.3 → csemod-0.0.4}/csemod/__init__.py +0 -0
- {csemod-0.0.3 → csemod-0.0.4}/csemod/main.py +0 -0
- {csemod-0.0.3 → csemod-0.0.4}/csemod.egg-info/SOURCES.txt +0 -0
- {csemod-0.0.3 → csemod-0.0.4}/csemod.egg-info/dependency_links.txt +0 -0
- {csemod-0.0.3 → csemod-0.0.4}/csemod.egg-info/requires.txt +0 -0
- {csemod-0.0.3 → csemod-0.0.4}/csemod.egg-info/top_level.txt +0 -0
|
@@ -1808,6 +1808,55 @@ int main() {
|
|
|
1808
1808
|
}
|
|
1809
1809
|
"""
|
|
1810
1810
|
|
|
1811
|
+
# Binary Search Program (C++)
|
|
1812
|
+
binary_search = """
|
|
1813
|
+
#include <iostream>
|
|
1814
|
+
using namespace std;
|
|
1815
|
+
|
|
1816
|
+
int main() {
|
|
1817
|
+
int arr[100];
|
|
1818
|
+
int size, key;
|
|
1819
|
+
int low, high, mid;
|
|
1820
|
+
bool found = false;
|
|
1821
|
+
|
|
1822
|
+
cout << "Enter size of array: ";
|
|
1823
|
+
cin >> size;
|
|
1824
|
+
|
|
1825
|
+
cout << "Enter elements in sorted order: " << endl;
|
|
1826
|
+
for (int i = 0; i < size; i++) {
|
|
1827
|
+
cin >> arr[i];
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
cout << "Enter element to search: ";
|
|
1831
|
+
cin >> key;
|
|
1832
|
+
|
|
1833
|
+
low = 0;
|
|
1834
|
+
high = size - 1;
|
|
1835
|
+
|
|
1836
|
+
while (low <= high) {
|
|
1837
|
+
mid = (low + high) / 2;
|
|
1838
|
+
|
|
1839
|
+
if (arr[mid] == key) {
|
|
1840
|
+
cout << "Element found at position: " << mid << endl;
|
|
1841
|
+
found = true;
|
|
1842
|
+
break;
|
|
1843
|
+
}
|
|
1844
|
+
else if (arr[mid] < key) {
|
|
1845
|
+
low = mid + 1;
|
|
1846
|
+
}
|
|
1847
|
+
else {
|
|
1848
|
+
high = mid - 1;
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
if (!found) {
|
|
1853
|
+
cout << "Element not found." << endl;
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
return 0;
|
|
1857
|
+
}
|
|
1858
|
+
"""
|
|
1859
|
+
|
|
1811
1860
|
|
|
1812
1861
|
answer_dict = {
|
|
1813
1862
|
"insertelement": insert_element,
|
|
@@ -1820,6 +1869,7 @@ answer_dict = {
|
|
|
1820
1869
|
"linearqueue": linear_queue,
|
|
1821
1870
|
"circularqueue": circular_queue,
|
|
1822
1871
|
"priorityqueue": prioriy_queue,
|
|
1872
|
+
"binarysearch": binary_search,
|
|
1823
1873
|
"linkedlist": linked_list,
|
|
1824
1874
|
"grade": prog1_grade,
|
|
1825
1875
|
"factors": prog2_factors,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|