Counting Sort

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define MAX_VALUE 10001

int n, m;
int a[MAX_VALUE];

int main()
{
    printf("Count : ");
    scanf("%d", &n);
    printf("\r\n\r\n");
    for (int i = 0; i < n; i++) {
        printf("a[%d] : ", i);
        scanf("%d", &m); 
        a[m]++; 
    }
    printf("\r\n\r\n");
    printf("Result :");
    printf("\r\n");
    for (int i = 0; i < MAX_VALUE; i++) {
        while (a[i] != 0) {
            printf("%d ", i);
            a[i]--;
        }
    }

    printf("\r\n\r\n");
    system("pause");
}

 

 

be the happy Gosu.

woojja ))*

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 

반응형

'ETC > C, C++' 카테고리의 다른 글

[C, C++] Selection Sort, Insertion Sort  (0) 2021.11.04
[C, C++] Queue in Array, Linked List  (0) 2021.10.20
[C, C++] Stack in Array, Lined List  (0) 2021.10.20
[C, C++] Sorted Doubly Linked List  (0) 2021.10.20

 

When the following error occurs like this

"oracle input pattern or replacement parameters exceed 32K size limit ... CLOB ..."

 

CREATE OR REPLACE FUNCTION REPLACE_CLOB( p_origin                          IN CLOB
                                	, p_search_text                     IN VARCHAR2
                                	, p_replace                         IN CLOB
) 
RETURN CLOB 
IS
    l_pos pls_integer;
    out_replace_clob CLOB := p_origin;
BEGIN
    l_pos := instr(p_origin, p_search_text);

    IF l_pos > 0 THEN
        WHILE l_pos > 0 LOOP
            out_replace_clob := substr(out_replace_clob, 1, l_pos-1)
            || p_replace
            || substr(out_replace_clob, l_pos + LENGTH(p_search_text));

            l_pos := instr(out_replace_clob, p_search_text);
        END LOOP;
        RETURN out_replace_clob;
    END IF;

    RETURN p_origin;
END REPLACE_CLOB;

-- v_huge_sql := REPLACE_CLOB(v_huge_sql, '[[REPLACE_LOCATION_IN_QUERY]]'    , v_huge_replace_text);

 

be the happy Gosu.

woojja ))*

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

반응형

The maximum number of columns allowed in a table of ORACLE are 1000.

(in 8i, 9i, 10g, 11g, 12c, 18c and 19c)

(ORACLE 7 had 254 columns limit.)

 

be the happy Gosu.

woojja ))*

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

반응형

The following syntax converts a DataTable to a Dictionary .

 

in C#

Dictionary<string, string> dicCodes = ds.Tables[0].AsEnumerable()
                                    .ToDictionary<DataRow, string, string>(
                                        row => row.Field<string>("Column1Name"),
                                        row => row.Field<string>("Column2Name")
                                    );

 

in VB.NET

Dim dicCodes As Dictionary(Of String, String) =
    ds.Tables(0).AsEnumerable() _
    .ToDictionary(Of String, String)(
                                        Function(row) row.Field(Of String)("Column1Name"),
                                        Function(row) row.Field(Of String)("Column2Name")
                                    )

 

be the happy Gosu.

woojja ))*

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

반응형

+ Recent posts