Language: C++

Last login: Wed Mar  6 15:02:27 on console
MBA:~ Rihito$ cd prog/aizu/
MBA:aizu Rihito$ ls
course1	course2	course3	course4	course5	course6	volume0	volume1
MBA:aizu Rihito$ cd course6
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
7
2 5 1 3 2 3 0
1 1 1 1 1 0 0
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
7
2 5 1 3 2 3 0
0 0 0 0 1 2 3
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
7
2 5 1 3 2 3 0
0 0 0 1 0 2 3
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
7
2 5 1 3 2 3 0
2 2 2 2 0 0 0
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
7
2 5 1 3 2 3 0
2 2 2 2 0 0 0
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
7
2 5 1 3 2 3 0
0 0 1 2 2 3 3
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
7
2 5 1 3 2 3 0
0 1 2 2 3 3 5
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
7
2 5 1 3 2 3 0
0 1 2 2 3 3 5
MBA:course6 Rihito$ ./counting_sort 
1
1
0
MBA:course6 Rihito$ ./counting_sort 
2
1 1
0 0
MBA:course6 Rihito$ ./counting_sort 
3 
1 2 3
0 0 0
MBA:course6 Rihito$ ./counting_sort 
6
1 7 5 3 4 2
0 1 2 3 4 5
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
7
2 5 1 3 2 3 0
0 0 1 2 2 3 3
MBA:course6 Rihito$ ./counting_sort 
3
2 5 4
0 0 0
MBA:course6 Rihito$ ./counting_sort 
9
9 8 7 6 5 4 3 2 1
2 3 4 5 6 7 8 9 0
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
9
9 8 7 6 5 4 3 2 1 
0 2 3 4 5 6 7 8 9
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
7
2 5 1 3 2 3 0
0 0 0 1 2 2 3
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
7
2 5 1 3 2 3 0
0 1 2 2 3 3 5
MBA:course6 Rihito$ ./counting_sort 
9
9 8 7 6 5 4 3 2 1
3 4 5 6 7 8 9 0 0
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
7
2 5 1 3 2 3 0
2 3 5 7 7 8 8 8 8 8 
0 0 1 2 2 3 3
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
7
2 5 1 3 2 3 0
1 2 4 6 6 7 7 7 7 7 
0 1 2 2 3 3 5
MBA:course6 Rihito$ ./counting_sort 
7
7 6 5 4 3 2 1
0 1 2 3 4 5 6 7 7 7 
1 2 3 4 5 6 7
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
counting_sort.cpp:7: error: expected ???,??? or ???...??? before numeric constant
counting_sort.cpp: In function ???int main()???:
counting_sort.cpp:7: error: too many arguments to function ???void counting_sort(int*, int*)???
counting_sort.cpp:19: error: at this point in file
counting_sort.cpp: At global scope:
counting_sort.cpp:26: error: expected ???,??? or ???...??? before numeric constant
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
7
#include <iostream>

using namespace std;

void counting_sort(int a[], int b[], int k);

int n;
int A[2000000];
int B[2000000];
int c[10001];

int main(){
    cin>>n;
    for (int i=0; i<n; i++) {
        cin>>A[i];
    }
    counting_sort(A,B,10001);
    for (int i=0; i<n-1; i++) {
        cout<<B[i]<<" ";
    }
    cout<<B[n-1]<<endl;
}

void counting_sort(int a[], int b[], int k){
    for (int i =0 ; i<k; i++) {
        c[i] = 0;
    }
    for (int j=0; j<sizeof(a)-1; j++) {
        c[a[j]] ++;
    }
    for (int i=1; i<k-1; i++) {
        c[i]=c[i]+c[i-1];
    }
//    for (int i=0; i<10; i++) {
//        cout<<c[i]<<" ";
//    }
//    cout<<endl;
    for (int j=n-1; j>=0; j--) {
        b[c[a[j]]-1] = a[j];
        c[a[j]]--;
    }
}7 7 7 7 7 7 7 7 7 7 
0 0 0 0 0 0 0
MBA:course6 Rihito$ 
MBA:course6 Rihito$ using namespace std;
-bash: using: command not found
MBA:course6 Rihito$ 
MBA:course6 Rihito$ void counting_sort(int a[], int b[], int k);
-bash: syntax error near unexpected token `('
MBA:course6 Rihito$ 
MBA:course6 Rihito$ int n;
-bash: int: command not found
MBA:course6 Rihito$ int A[2000000];
-bash: int: command not found
MBA:course6 Rihito$ int B[2000000];
-bash: int: command not found
MBA:course6 Rihito$ int c[10001];
-bash: int: command not found
MBA:course6 Rihito$ 
MBA:course6 Rihito$ int main(){
-bash: syntax error near unexpected token `('
MBA:course6 Rihito$     cin>>n;
-bash: cin: command not found
MBA:course6 Rihito$     for (int i=0; i<n; i++) {
-bash: syntax error near unexpected token `('
MBA:course6 Rihito$         cin>>A[i];
-bash: cin: command not found
MBA:course6 Rihito$     }
-bash: syntax error near unexpected token `}'
MBA:course6 Rihito$     counting_sort(A,B,10001);
-bash: syntax error near unexpected token `A,B,10001'
MBA:course6 Rihito$     for (int i=0; i<n-1; i++) {
-bash: syntax error near unexpected token `('
MBA:course6 Rihito$         cout<<B[i]<<" ";
>     }
>     cout<<B[n-1]<<endl;
> }
> 
> void counting_sort(int a[], int b[], int k){
>     for (int i =0 ; i<k; i++) {
>         c[i] = 0;
>     }
>     for (int j=0; j<sizeof(a)-1; j++) {
>         c[a[j]] ++;
>     }
>     for (int i=1; i<k-1; i++) {
>         c[i]=c[i]+c[i-1];
>     }
> //    for (int i=0; i<10; i++) {
> //        cout<<c[i]<<" ";
> //    }
> //    cout<<endl;
>     for (int j=n-1; j>=0; j--) {
>         b[c[a[j]]-1] = a[j];
>         c[a[j]]--;
>     }
> }
MBA:course6 Rihito$ g++ 
A[i]               counting_sort.cpp  n                  
counting_sort      counting_sort.h    
MBA:course6 Rihito$ g++ counting_sort.cpp -o 
A[i]               counting_sort.cpp  n                  
counting_sort      counting_sort.h    
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
1
1
6 7 7 7 7 7 7 7 7 7 
0
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
1
1
0
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
2
1 2
0 0
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
3
1 2 3
0 0 0
MBA:course6 Rihito$ ./counting_sort 
4
1 4 3 3
0 0 0 1
MBA:course6 Rihito$ ./counting_sort 
5
6 5 3 4 5
0 0 3 4 5
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
1
1
7 8 8 8 8 8 8 8 8 8 
0
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
1
1
7 8 8 8 8 8 8 8 8 8 
0
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
1
1
7 8 8 8 8 8 8 8 8 8 
0
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
1
2
7 7 8 8 8 8 8 8 8 8 
0
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
2
1
1
0 0 0 0 0 0 0 0 0 0 
6 8 8 8 8 8 8 8 8 8 
0 0
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
1
2
7 0 1 0 0 0 0 0 0 0 
7 7 8 8 8 8 8 8 8 8 
0
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
1
2
0
0
1
2
3
4
5
6
7 0 1 0 0 0 0 0 0 0 
7 7 8 8 8 8 8 8 8 8 
0
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
1
2
0
0 0 1 0 0 0 0 0 0 0 
0 0 1 1 1 1 1 1 1 1 
2
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
MBA:course6 Rihito$ ./counting_sort 
1
2
2
MBA:course6 Rihito$ ./counting_sort 
3
3 2 1
1 2 3
MBA:course6 Rihito$ ./counting_sort 
7
2 5 1 3 2 3 0
0 1 2 2 3 3 5
MBA:course6 Rihito$ g++ counting_sort.cpp -o counting_sort
^PMBA:course6 Rihito
MBA:course6 Rihito$ g++ 
.DS_Store          counting_sort.cpp  partition.cpp      
counting_sort      counting_sort.h    partition.h        
MBA:course6 Rihito$ g++ partition.cpp -o partition
partition.cpp: In function ???int main()???:
partition.cpp:16: error: ???r??? was not declared in this scope
MBA:course6 Rihito$ g++ partition.cpp -o partition
MBA:course6 Rihito$ ./partition 
12
13 19 9 5 12 8 7 4 21 2 6 11
9 5 8 7 4 2 6 11 21 13 19 12 
7
MBA:course6 Rihito$ g++ partition.cpp -o partition
MBA:course6 Rihito$ ./partition 
12
12
13 19 9 5 12 8 7 4 21 2 6 11
5 4 2 [6] 12 12 8 7 13 21 19 9 
MBA:course6 Rihito$ ./partition 
12
13 19 9 5 12 8 7 4 21 2 6 11
9 5 8 7 4 2 6 [11] 21 13 19 12 
MBA:course6 Rihito$ vim input
MBA:course6 Rihito$ ./partition < input
9 5 8 7 4 2 6 [11] 21 13 19 12 
MBA:course6 Rihito$ g++ partition.cpp -o partition
partition.cpp: In function ???int main()???:
partition.cpp:21: error: name lookup of ???i??? changed for new ISO ???for??? scoping
partition.cpp:18: error:   using obsolete binding at ???i???
MBA:course6 Rihito$ g++ partition.cpp -o partition
MBA:course6 Rihito$ ./partition < input
9 5 8 7 4 2 6 [11] 21 13 19 12
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
quick_sort.cpp: In function ???int main()???:
quick_sort.cpp:18: error: ???array??? was not declared in this scope
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ vim

[1]+  Stopped                 vim
MBA:course6 Rihito$ vim input1
MBA:course6 Rihito$ vim input2
MBA:course6 Rihito$ ./quick_sort < input1
MBA:course6 Rihito$ ./quick_sort
6
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
quick_sort.cpp: In function ???int main()???:
quick_sort.cpp:16: error: request for member ???first??? in ???cards???, which is of non-class type ???std::pair<char, int> [10000]???
quick_sort.cpp:16: error: request for member ???second??? in ???cards???, which is of non-class type ???std::pair<char, int> [10000]???
quick_sort.cpp:20: error: request for member ???first??? in ???cards???, which is of non-class type ???std::pair<char, int> [10000]???
quick_sort.cpp:20: error: request for member ???second??? in ???cards???, which is of non-class type ???std::pair<char, int> [10000]???
quick_sort.cpp:22: error: cannot convert ???std::pair<char, int>*??? to ???int*??? for argument ???1??? to ???void quickSort(int*, int, int)???
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
quick_sort.cpp: In function ???int main()???:
quick_sort.cpp:22: error: cannot convert ???std::pair<char, int>*??? to ???int*??? for argument ???1??? to ???void quickSort(int*, int, int)???
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
quick_sort.cpp:11: error: expected initializer before ???string???
quick_sort.cpp: In function ???int main()???:
quick_sort.cpp:19: error: ???cards??? was not declared in this scope
quick_sort.cpp:23: error: ???cards??? was not declared in this scope
quick_sort.cpp:25: error: ???cards??? was not declared in this scope
quick_sort.cpp: In function ???void quickSort(std::pair<char, int>*, int, int)???:
quick_sort.cpp:31: error: cannot convert ???std::pair<char, int>*??? to ???int*??? for argument ???1??? to ???int partition(int*, int, int)???
quick_sort.cpp: In function ???int partition(std::pair<char, int>*, int, int)???:
quick_sort.cpp:38: error: cannot convert ???std::pair<char, int>??? to ???int??? in initialization
quick_sort.cpp:41: error: no match for ???operator<=??? in ???a[j] <= x???
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
quick_sort.cpp: In function ???int main()???:
quick_sort.cpp:25: error: cannot convert ???std::pair<char, int>*??? to ???int*??? for argument ???1??? to ???void quickSort(int*, int, int)???
quick_sort.cpp: In function ???void quickSort(std::pair<char, int>*, int, int)???:
quick_sort.cpp:31: error: cannot convert ???std::pair<char, int>*??? to ???int*??? for argument ???1??? to ???int partition(int*, int, int)???
quick_sort.cpp: In function ???int partition(std::pair<char, int>*, int, int)???:
quick_sort.cpp:38: error: cannot convert ???std::pair<char, int>??? to ???int??? in initialization
quick_sort.cpp:41: error: no match for ???operator<=??? in ???a[j] <= x???
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
quick_sort.cpp: In function ???int partition(std::pair<char, int>*, int, int)???:
quick_sort.cpp:38: error: cannot convert ???std::pair<char, int>??? to ???int??? in initialization
quick_sort.cpp:41: error: no match for ???operator<=??? in ???a[j] <= x???
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
a
D 3
H 2
D 1
S 3
D 2
C 1
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
a
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
Segmentation fault: 11
MBA:course6 Rihito$ emacs input1

[2]+  Stopped                 emacs input1
MBA:course6 Rihito$ ./quick_sort
6
D 3
H 2
D 1
S 3
D 2
C 1
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
D 3
H 2
D 1
S 3
D 2
C 1
b
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
D 3
H 2
D 1
S 3
D 2
C 1
b
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
in
in
in
in
in
in
in
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
in
in
in
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
quick_sort.cpp: In function ???int partition(std::pair<char, int>*, int, int)???:
quick_sort.cpp:56: error: no match for ???operator<<??? in ???std::cout << a[i]???
/usr/include/c++/4.2.1/ostream:112: note: candidates are: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>& (*)(std::basic_ostream<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2.1/ostream:121: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ios<_CharT, _Traits>& (*)(std::basic_ios<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2.1/ostream:131: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2.1/ostream:169: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2.1/ostream:177: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2.1/ostream:185: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2.1/bits/ostream.tcc:92: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2.1/ostream:196: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2.1/bits/ostream.tcc:106: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2.1/ostream:207: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2.1/ostream:220: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2.1/ostream:228: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2.1/ostream:237: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2.1/ostream:245: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2.1/ostream:253: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2.1/ostream:261: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2.1/bits/ostream.tcc:120: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_streambuf<_CharT, _Traits>*) [with _CharT = char, _Traits = std::char_traits<char>]
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
D1 C1 D3 S3 
D2 H2 

Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
D1 C1 D3 S3 
D2 H2 

Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
D1 C1 D3 S3 
D2 H2 

Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
D1 C1 S3 
D2 
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
D1 C1 D3 S3 D2 H2 
D2 H2 D3 S3 
D3 S3 
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
C1 H2 D1 S3 D2 D3 
H2 D1 D2 D3 S3 
D1 D2 H2 
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
D1 C1 D3 S3 D2 H2 
D2 H2 D3 S3 
D3 S3 
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
D1 C1 D3 S3 D2 H2 
1
2
D2 H2 D3 S3 
1
2
D3 S3 
1
2
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
D1 C1 D3 S3 D2 H2 
p,q,r :0 1 5
1
2
D2 H2 D3 S3 
p,q,r :2 3 5
1
2
D3 S3 
p,q,r :4 5 5
1
2
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
D1 C1 D3 S3 D2 H2 
p,q,r :0 1 5
1
2
D2 H2 D3 S3 
p,q,r :2 3 5
1
2
D3 S3 
p,q,r :4 5 5
1
2
3
3
3
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
D1 C1 D3 S3 D2 H2 
p,q,r :0 1 5
1
2
D2 H2 D3 S3 
p,q,r :2 3 5
1
2
D3 S3 
p,q,r :4 5 5
1
2
3
3
3
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
D1 C1 D3 S3 D2 H2 
p,q,r :0 1 5
1
2
D2 H2 D3 S3 
p,q,r :2 3 5
1
2
D3 S3 
p,q,r :4 5 5
1
2
3
3
3
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
D1 C1 D3 S3 D2 H2 
p,q,r :0 1 5
1
2
D2 H2 D3 S3 
p,q,r :2 3 5
1
2
D3 S3 
p,q,r :4 5 5
1
2
3
3
3
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort -d
cc1plus: error: missing argument to "-d"
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort -db
cc1plus: warning: unrecognized gcc debugging option: b
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
in
D1 C1 D3 S3 D2 H2 
p,q,r :0 1 5
1
2
in
D2 H2 D3 S3 
p,q,r :2 3 5
1
2
in
D3 S3 
p,q,r :4 5 5
1
2
3
3
3
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
in
D1 C1 D3 S3 D2 H2 
p,q,r :0 1 5
1
out
2
in
D2 H2 D3 S3 
p,q,r :2 3 5
1
out
2
in
D3 S3 
p,q,r :4 5 5
1
out
2
out
3
3
3
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
b
in
D1 C1 D3 S3 D2 H2 
p,q,r :0 1 5
1
out
2
in
D2 H2 D3 S3 
p,q,r :2 3 5
1
out
2
in
D3 S3 
p,q,r :4 5 5
1
out
2
out
3
3
3
a
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
D1 C1 D3 S3 D2 H2 
D2 H2 D3 S3 
D3 S3 
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
sort end
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
sort end
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
sort end
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
sort end
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
sort end
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
sort end
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
sort end
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
sort end
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
sort end
Segmentation fault: 11
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
sort end
in
b
a
Not stable
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
sort end
Not stable
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
sort end
Not stable
MBA:course6 Rihito$ g++ quick_sort.cpp -o quick_sort
MBA:course6 Rihito$ ./quick_sort < input1
sort end
Segmentation fault: 11
MBA:course6 Rihito$ 

Compiler output:
a.cc:169:43: error: stray '`' in program
  169 | -bash: syntax error near unexpected token `('
      |                                           ^
a.cc:169:45: warning: missing terminating ' character
  169 | -bash: syntax error near unexpected token `('
      |                                             ^
a.cc:169:45: error: missing terminating ' character
a.cc:181:43: error: stray '`' in program
  181 | -bash: syntax error near unexpected token `('
      |                                           ^
a.cc:181:45: warning: missing terminating ' character
  181 | -bash: syntax error near unexpected token `('
      |                                             ^
a.cc:181:45: error: missing terminating ' character
a.cc:185:43: error: stray '`' in program
  185 | -bash: syntax error near unexpected token `('
      |                                           ^
a.cc:185:45: warning: missing terminating ' character
  185 | -bash: syntax error near unexpected token `('
      |                                             ^
a.cc:185:45: error: missing terminating ' character
a.cc:189:43: error: stray '`' in program
  189 | -bash: syntax error near unexpected token `}'
      |                                           ^
a.cc:189:45: warning: missing terminating ' character
  189 | -bash: syntax error near unexpected token `}'
      |                                             ^
a.cc:189:45: error: missing terminating ' character
a.cc:191:43: error: stray '`' in program
  191 | -bash: syntax error near unexpected token `A,B,10001'
      |                                           ^
a.cc:191:53: warning: missing terminating ' character
  191 | -bash: syntax error near unexpected token `A,B,10001'
      |                                                     ^
a.cc:191:53: error: missing terminating ' character
a.cc:193:43: error: stray '`' in program
  193 | -bash: syntax error near unexpected token `('
      |                                           ^
a.cc:193:45: warning: missing terminating ' character
  193 | -bash: syntax error near unexpected token `('
      |                                             ^
a.cc:193:45: error: missing terminating ' character
a.cc:502:18: error: too many decimal points in number
  502 | /usr/include/c++/4.2.1/ostream:112: note: candidates are: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>& (*)(std::basic_ostream<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:503:18: error: too many decimal points in number
  503 | /usr/include/c++/4.2.1/ostream:121: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ios<_CharT, _Traits>& (*)(std::basic_ios<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:504:18: error: too many decimal points in number
  504 | /usr/include/c++/4.2.1/ostream:131: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:505:18: error: too many decimal points in number
  505 | /usr/include/c++/4.2.1/ostream:169: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:506:18: error: too many decimal points in number
  506 | /usr/include/c++/4.2.1/ostream:177: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:507:18: error: too many decimal points in number
  507 | /usr/include/c++/4.2.1/ostream:185: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:508:18: error: too many decimal points in number
  508 | /usr/include/c++/4.2.1/bits/ostream.tcc:92: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:509:18: error: too many decimal points in number
  509 | /usr/include/c++/4.2.1/ostream:196: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:510:18: error: too many decimal points in number
  510 | /usr/include/c++/4.2.1/bits/ostream.tcc:106: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:511:18: error: too many decimal points in number
  511 | /usr/include/c++/4.2.1/ostream:207: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:512:18: error: too many decimal points in number
  512 | /usr/include/c++/4.2.1/ostream:220: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:513:18: error: too many decimal points in number
  513 | /usr/include/c++/4.2.1/ostream:228: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:514:18: error: too many decimal points in number
  514 | /usr/include/c++/4.2.1/ostream:237: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:515:18: error: too many decimal points in number
  515 | /usr/include/c++/4.2.1/ostream:245: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:516:18: error: too many decimal points in number
  516 | /usr/include/c++/4.2.1/ostream:253: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:517:18: error: too many decimal points in number
  517 | /usr/include/c++/4.2.1/ostream:261: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:518:18: error: too many decimal points in number
  518 | /usr/include/c++/4.2.1/bits/ostream.tcc:120: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_streambuf<_CharT, _Traits>*) [with _CharT = char, _Traits = std::char_traits<char>]
      |                  ^~~~~
a.cc:1:1: error: 'Last' does not name a type
    1 | Last login: Wed Mar  6 15:02:27 on console
      | ^~~~
In file included from /usr/include/c++/14/iosfwd:42,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:121:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
   68 |   typedef ptrdiff_t     streamsize; // Signed integral type
      |           ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
   40 | #include <cwchar> // For mbstate_t
  +++ |+#include <cstddef>
   41 | 
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
  131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                                            ^~~~~~
In file included from /usr/include/wchar.h:35,
                 from /usr/include/c++/14/cwchar:44,
                 from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
  132 |   __attribute__((__externally_visible__));
      |                                         ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
  133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                                              ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
  134 |   __attr