search.h

Overview

Related Modules:

UTILS

Description:

Provides functions and related data structures, such as creating, destroying, or searching for a hash table.

You can use the functions provided in this file to perform operations related to wide character types during development, such as, creating, destroying, or searching for a hash table, and creating or searching for a binary tree.

Since:

1.0

Version:

1.0

Summary

Data Structures

Data Structure Name

Description

entry

Defines a hash table entry.

qelem

Creates a queue from the doubly linked list for insque and remque.

hsearch_data

Defines a hash table.

Typedefs

Typedef Name

Description

ENTRY

typedef struct entry 

Defines a hash table entry.

Functions

Function Name

Description

hcreate (size_t nel)

int 

Creates a hash table based on the number of entries.

hdestroy (void)

void 

Destroys a hash table.

hsearch (ENTRY item, ACTION action)

ENTRY  

Adds or searches for a hash entry.

hcreate_r (size_t nel, struct hsearch_data htab)

int 

Creates a hash table based on the number of entries and its description.

hdestroy_r (struct hsearch_data htab)

void 

Destroys a hash table.

hsearch_r (ENTRY item, ACTION action, ENTRY **retval, struct hsearch_data htab)

int 

Searches for a hash table.

insque (void element, void pred)

void 

Adds an entry to a queue.

remque (void elem)

void 

Removes an entry from a queue.

lsearch (const void key, const void base, size_t nelp, size_t width, int(compar)(const void , const void ))

void  

Performs a linear search for a key in the array and adds a key to the end of the array if the key is not found.

lfind (const void key, const void base, size_t nelp, size_t width, int(compar)(const void , const void ))

void  

Performs a linear search for a key in the array.

tdelete (const void key, void *rootp, int(compar)(const void , const void ))

void  

Deletes a key from the binary tree.

tfind (const void key, void const rootp, int(compar)(const void , const void ))

void  

Searches for a key in the binary tree.

tsearch (const void key, void const rootp, int(compar)(const void , const void ))

void  

Searches for a key in the binary tree and adds a key to the tree if the key is not found.

twalk (const void root, void(action)(const void nodep, VISIT which, int depth))

void 

Traverses a binary tree from left to right.

tdestroy (void root, void(free_node)(void *nodep))

void 

Releases all nodes in the binary tree.