Ask the experts for C solutions to data structures.

Updated on technology 2024-05-19
3 answers
  1. Anonymous users2024-02-11

    2.Pattern matching, exhaustive and KMP algorithms are available, C language.

    #include

    x, m, y, and n are the data that needs to be matched.

    s stores the matching position c is the number of matches*

    void kmp(x,m,y,n,s,c);

    void find(x,m,y,n,s,c)char *x;

    int m;

    char *y;

    int n;

    int* s;

    int* c;

    int i, j, t;

    c=0;for (i=0;i=0)

    i = f[i];

    if (*y+j)==*(y+i+1))

    f[j] = i+1;

    elsef[j] = -1;

    c = j = i = 0;

    while ( j

    #include

    using namespace std;

    void getstr(char* p){cout<<"Please enter the expression string:"<>p;

    return;

    void main(){

    stackst;

    char str[255];

    getstr(str);

    char k;

    int i=0;

    int st_error=0;

    while ( k=str[i]) = null)if (k == '(' )

    if (k == ')' )

    if ( == 0 )

    st_error=1;

    break;

    <"The match check passes"<0) cout<<"Missing closing parentheses! "<

  2. Anonymous users2024-02-10

    The landlord is from the South Post, no, why is it so similar to the topic I did?

  3. Anonymous users2024-02-09

    There are five kinds of characters g(4), o(6), e(1), s(2), and d(2), and the number of nodes is 2*n-1, so a total of 2*5-1=9 nodes with weighted paths can be calculated by the Huffman tree.

    The construction method of the Hefman tree is to find the two smallest weights to form the subtree at a time, and their sum is used as a new weight to participate in the construction, the original two responsibilities are removed from the weight set, and then the smallest of the two sets is found to form the subtree, and go down at once.

    o: 1,g:01 , d:001 , s:0001, e:0000

Related questions
9 answers2024-05-19

A hash table (also known as a hash table) is a data structure that is directly accessed based on the key value. That is, it accesses records by mapping key values to a location in the table to speed up lookups. This mapping function is called a hash function, and the array that holds the records is called a hash table. >>>More

3 answers2024-05-19

I have the same issue.

18 answers2024-05-19

It's not low, but it's ......It's not worth the effort ...... this program

12 answers2024-05-19

C++ Data Structures and Programming", Translated Edition, Robert LKruuse and Alexander Jby Ryba. >>>More