first commit

This commit is contained in:
Jose Caban
2025-06-07 11:34:38 -04:00
commit 0eb2d7c07d
4708 changed files with 1500614 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
STL generic algorithms -- initialization algorithms
Illustrate fill function
xxxxxxxxxx
empty empty empty empty empty empty empty empty empty empty
full full full full full full full full full full
00000078910
Illustrate copy function
surprise
big surprise
Illustrate generate algorithm
L_0 L_1 L_2 L_3
7 8 9 10 11 7 8 9 10 11
Illustrate swap_ranges algorithm
14 27 12 64
4 2 3 1
4 2 3 1
14 27 12 64
End of initialization tests

View File

@@ -0,0 +1,23 @@
STL generic algorithms -- Searching Algorithms
Test of algorithm find
first vintage leap year is 1972
1995 is position 4 in sequence
Test of algorithm find adjacent
In the text The bookkeeper carefully opened the door
double o in position 5
double k in position 7
double e in position 9
double l in position 21
double o in position 37
Test of algorithm search
substring begins in position 4
Test of max and min algorithms
largest value was 93
smallest value was 11
The smallest word is best and the largest word is worst
string goody is equal to goody
string good is less than goody
string goody is greater than good
string good is greater than fred
string fred is less than good
End of search algorithms test program

View File

@@ -0,0 +1,44 @@
STL generic algorithms -- in-place algorithms
Illustrate std::reverse() algorithm
<Rats live on no evil star>
>rats live on no evil staR<
2 3 4 5 6 7 8 9 10 11
11 10 9 8 7 6 5 4 3 2
Illustrate std::replace() algorithm
0 1 2 3 4 5 4 3 2 1 0
0 1 2 7 4 5 4 7 2 1 0
9 1 9 7 9 5 9 7 9 1 9
7 1 4 3 7 5
8 1 8 3 8 8
Illustrate std::rotate() algorithm
7 8 9 10 1 2 3 4 5 6
3 4 5 6 7 8 9 10 1 2
Illustrate std::partition() algorithm
10 2 8 4 6 5 7 3 9 1
middle location 5
1 2 3 4 5 6 7 8 9 10
Illustrate std::next_permutation() algorithm
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1
Alpha Beta Gamma
Alpha Gamma Beta
Beta Alpha Gamma
Beta Gamma Alpha
Gamma Alpha Beta
Gamma Beta Alpha
Illustrate std::prev_permutation() algorithm
bela beal bale bael aleb albe aelb aebl able abel
Illustrate std::inplace_merge() algorithm
0 2 4 6 8 1 3 5 7 9
0 2 4 6 8 1 3 5 7 9
0 1 2 3 4 5 6 7 8 9
Illustrate std::generate() algorithm
1 2 3 4 5 6 7 8 9 10
Illustrate std::random_shuffle() algorithm
10 9 1 7 8 4 5 6 2 3
4 2 6 5 9 3 10 7 1 8
End of in-place algorithm sample program

View File

@@ -0,0 +1,12 @@
STL generic algorithms -- Removal Algorithms
Remove Algorithm examples
Original list: 1 2 4 3 1 4 2
After removing 2's: 1 4 3 1 4
List after removal, before erase: 1 4 3 1 4 4 2
List after erase: 1 4 3 1 4
List after removing even values: 1 3 1
Origianal List: 1 3 3 2 2 4
Set after unique_copy: 1 2 3 4
List after calling unique: 1 3 2 4 2 4
List after erase: 1 3 2 4
End of removal algorithms sample program

View File

@@ -0,0 +1,15 @@
STL generic algorithms -- algorithms that produce scalar results
There are 3 letter e's
and 8 vowels in the text:Now is the time to begin
The sum of the first five numbers is 15
The product of the first five numbers is 120
1 2 1 3 2 1 4 3 2 1 5 4 3 2 1
Inner product is 33
any equal? 1
a = b is:0
a = c is:1
a pair-wise-greater_equal b is1
compare everybody to everything 1
compare a to b: 0
compare a to c: 1
End of scalar algorithms test

View File

@@ -0,0 +1,12 @@
STL generic algorithms -- that transform sequences
Original list: 1 2 3 4 5 6
After squaring: 1 4 9 16 25 36
After squaring again: 1 16 81 256 625 1296
After division: 1 8 27 64 125 216
Partial sums examples
Partial sums : 1 3 6 10 15
Partial products: 1 2 6 24 120
Adjacent Differences examples
Adjacent Differences : 1 1 1 1 1
Adjacent sums: 1 3 5 7 9
End generic transform algorithms example

View File

@@ -0,0 +1,32 @@
Sorting generic algorithms examples
Sort algorithms
4 4 10 13 37 50 51 56 63 67 76 79 85 87 89
81 79 75 64 61 61 57 56 39 39 35 30 18 13 7
89 87 85 79 76 67 63 56 51 50 37 13 10 4 4
Partial sort examples
42 97 8 74 94 98 92 36 7 97 87 85 1 24 67
1 7 8 24 36 42 67 98 97 97 94 92 87 85 74
59 9 1 49 84 20 34 98 87 30 71 69 30 15 23
98 87 84 71 69 59 49
Nth largest example
fifth largest is 56 in
19 27 27 43 56 70 94 75 95 82
Binary search example
1 6 8 10 31 45 45 58 69 70 75 85 86 94 95
does not contain an 11
1 6 8 10 11 14 31 45 45 58 69 70 75 85 86 94 95
Merge algorithm examples
7 8 17 36 36 43 50 52 54 60 64 68 72 75 76 81 83 90 94 98
Set operations:
1 2 3 4 5 6 7
1 2 3 3 4 4 5 5 6 7
3 4 5
1 2
1 2 6 7
set is not subset
93 86 87 85 78 80 84 83 74 1 19 32 43 9 8
Largest value 93
87 86 84 85 78 80 9 83 74 1 19 32 43 8
97 86 87 85 78 80 84 83 74 1 19 32 43 8 9
1 8 9 19 32 43 74 78 80 83 84 85 86 87 97
End sorting examples

View File

@@ -0,0 +1 @@
Assertion - executable does not exist.

View File

@@ -0,0 +1,4 @@
Calculator example program, from Chapter 8
Enter a legal RPN expression, end with p q (print and quit)
-1
End calculator program

View File

@@ -0,0 +1 @@
Roots are (-0.949179,-1.25199) and (-0.820052,1.40583)

View File

@@ -0,0 +1,22 @@
Concordance sample program, from Chapter 7
Enter text, then end-of-file:
all: 3
and: 1 2 4
borogroves: 3
brillig: 1
did: 2
gimble: 2
gyre: 2
in: 2
mimsy: 3
mome: 4
outgrabe: 4
raths: 4
slithy: 1
the: 1 2 3 4
toves: 1
twas: 1
wabe: 2
were: 3
End of concordance sample program

View File

@@ -0,0 +1,6 @@
static_cast<const int&>(v1 = 1) = 1
static_cast<const double&>(v1 = 3.14) = 3.14
static_cast<const double&>(v2 = v1) = 3.14
static_cast<const char* const&>(v2 = "abc") = abc
static_cast<const char* const&>(v1 = v2) = abc
static_cast<const char&>(v3) = exception

View File

@@ -0,0 +1,10 @@
Graph example program - find shortest path in a directed graph.
Find the shortest path from : Pierre
Distance to: Pendleton:2
Distance to: Pensacola:19
Distance to: Peoria:10
Distance to: Phoenix:6
Distance to: Pierre:0
Distance to: Pittsburgh:15
Distance to: Pueblo:9
End of graph example program

View File

@@ -0,0 +1,56 @@
Ice Cream Store simulation from Chapter 9
pumping queue with event 0
pumping queue with event 0
pumping queue with event 2
pumping queue with event 7
pumping queue with event 8
pumping queue with event 12
pumping queue with event 12
pumping queue with event 12
pumping queue with event 14
pumping queue with event 17
Time: 0 group of 2 customers arrives is seated
Time: 0 group of 4 customers arrives is seated
Time: 2 group of 3 customers arrives is seated
Time: 3 serviced order for 4
Time: 3 serviced order for 1
Time: 3 serviced order for 1
Time: 3 serviced order for 3
Time: 4 serviced order for 4
Time: 4 serviced order for 1
Time: 4 group of size 4 leaves
Time: 5 serviced order for 2
Time: 5 serviced order for 1
Time: 5 serviced order for 3
Time: 7 group of 1 customers arrives is seated
Time: 7 group of size 2 leaves
Time: 7 group of size 3 leaves
Time: 8 group of 3 customers arrives is seated
Time: 10 serviced order for 3
Time: 12 group of 2 customers arrives is seated
Time: 12 group of 3 customers arrives is seated
Time: 12 serviced order for 2
Time: 12 serviced order for 2
Time: 12 serviced order for 4
Time: 12 group of 1 customers arrives is seated
Time: 14 serviced order for 3
Time: 14 serviced order for 4
Time: 14 group of 2 customers arrives is seated
Time: 15 serviced order for 4
Time: 16 serviced order for 1
Time: 16 serviced order for 3
Time: 16 serviced order for 2
Time: 17 serviced order for 2
Time: 17 serviced order for 2
Time: 17 group of 2 customers arrives is seated
Time: 18 group of size 1 leaves
Time: 19 group of size 1 leaves
Time: 21 group of size 2 leaves
Time: 21 group of size 3 leaves
Time: 21 group of size 3 leaves
Time: 21 serviced order for 3
Time: 21 serviced order for 4
Time: 24 group of size 2 leaves
Time: 27 group of size 2 leaves
Total profits 20.65
End of ice cream store simulation

View File

@@ -0,0 +1,7 @@
Radix sort program
730 301 852 593 624 415 426 146 987 78 269
301 415 624 426 730 146 852 269 78 987 593
78 146 269 301 415 426 593 624 730 852 987
78 146 269 301 415 426 593 624 730 852 987
78 146 269 301 415 426 593 624 730 852 987
End radix sort program

View File

@@ -0,0 +1,3 @@
Prime Sieve program, a test of vectors
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
End of Prime Sieve program

View File

@@ -0,0 +1,8 @@
Enter text:
Misspelled words:
a
canal
man
panama
plan
End of spell check program

View File

@@ -0,0 +1,16 @@
Telephone Directory sample program
Allen:6348723
Brenda:5436546
Fred:7435423
Samantha:6342343
Listing for prefix 634
Allen:6348723
Samantha:6342343
end of prefix listing
Display by prefix
5436546:Brenda
6342343:Samantha
6348723:Allen
7435423:Fred
end display by prefix
End of telephone directory sample program

View File

@@ -0,0 +1 @@
average wait: 0.781818

View File

@@ -0,0 +1,13 @@
Widget Works test program
Received shipment of widget type 1
Received shipment of widget type 2
Received shipment of widget type 3
Received order for widget type 2
Ship Widget 2
Received order for widget type 2
Back order widget of type 2
Received order for widget type 3
Ship Widget 3
Received shipment of widget type 2
Ship Widget 2 to fill back order
End of widget words test program