Skip to content

The project analyzes the performance of pattern-matching algorithms on pseudo-randomly generated texts of 500,000 characters. Tests were conducted using alphabets of sizes 2 and 70, with pattern lengths varying from 4 to 50.

License

Notifications You must be signed in to change notification settings

unixisking/pattern-matching-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trie Data Structure

This repository contains an implementation of a Trie (prefix tree) in C, a data structure used to store and search strings efficiently, especially useful in applications like autocomplete and spell-check.

Features

  • Insert words into the Trie.
  • Search words to check their existence in the Trie.
  • Add Prefixes of a word
  • Add Suffixes of a word
  • Add Factors of a word
Trie createTrie(int maxNode); void insertInTrie(Trie trie, unsigned char *w); int isInTrie(Trie trie, unsigned char *w);

Project Structure

Transition table implementation

  • trie-tm.h: Header file containing Trie structure definitions and function prototypes.
  • trie-tm.c: Source file with function implementations for the Trie operations.
  • main_tm.c: Example usage by adding the word the prefixes, suffixes, and the factors of "abaababa"
struct _trie { int maxNode; /* maximum number of trie nodes */ int nextNode; /* Index of next available node */ int **transitions; /* transition matrix */ char *finite; /* finite states */ }; typedef struct _trie *Trie;

Usage

And to run the transition table implementation :

make trie_tm && ./trie_tm

Hashtable based implementation

  • trie-ht.h: Header file containing Trie structure definitions and function prototypes.
  • trie-ht.c: Source file with function implementations for the Trie operations.
  • main_ht.c: Example usage by adding the word the prefixes, suffixes, and the factors of "abaababa"
struct _list { int startNode, targetNode; unsigned char letter; struct _list *next; }; typedef struct _list *List; struct _trie { int maxNode, /* Max amount of trie nodes */ nextNode; /* Index of next available node */ List **transitions; /* Adjacency list */ char *finite; /* Finite states */ }; typedef struct _trie *Trie;

Usage

To run the hash table implementation :

make trie_ht && ./trie_ht

About

The project analyzes the performance of pattern-matching algorithms on pseudo-randomly generated texts of 500,000 characters. Tests were conducted using alphabets of sizes 2 and 70, with pattern lengths varying from 4 to 50.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published