<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>http://comp.chem.tohoku.ac.jp/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Dictionary_data_structure</id>
	<title>Dictionary data structure - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="http://comp.chem.tohoku.ac.jp/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Dictionary_data_structure"/>
	<link rel="alternate" type="text/html" href="http://comp.chem.tohoku.ac.jp/mediawiki/index.php?title=Dictionary_data_structure&amp;action=history"/>
	<updated>2026-05-26T13:51:21Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.36.2</generator>
	<entry>
		<id>http://comp.chem.tohoku.ac.jp/mediawiki/index.php?title=Dictionary_data_structure&amp;diff=1117&amp;oldid=prev</id>
		<title>Hirano: ページの作成:「==Background==  The struct that provides user access to dictionary data structure.  This dictionary is actually an array of linked lists managed by a simple hash table.…」</title>
		<link rel="alternate" type="text/html" href="http://comp.chem.tohoku.ac.jp/mediawiki/index.php?title=Dictionary_data_structure&amp;diff=1117&amp;oldid=prev"/>
		<updated>2026-05-26T04:17:33Z</updated>

		<summary type="html">&lt;p&gt;ページの作成:「==Background==  The struct that provides user access to dictionary data structure.  This dictionary is actually an array of linked lists managed by a simple hash table.…」&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Background==&lt;br /&gt;
&lt;br /&gt;
The struct that provides user access to dictionary data structure. &lt;br /&gt;
This dictionary is actually an array of linked lists managed by a simple hash table.&lt;br /&gt;
&lt;br /&gt;
==Module structure==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;fortran&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
!!! Module for dictionary struct.&lt;br /&gt;
 !&lt;br /&gt;
 !     Note:&lt;br /&gt;
 !     Use is made of a hash table with each table corresponding &lt;br /&gt;
 !     to a linked list. This should speed up most&lt;br /&gt;
 !     operations.&lt;br /&gt;
 !&lt;br /&gt;
&lt;br /&gt;
MODULE dictionary_module&lt;br /&gt;
  USE list_data_module,ONLY: LIST_DATA&lt;br /&gt;
  USE linked_list_module,ONLY: linked_list_struct&lt;br /&gt;
  IMPLICIT NONE&lt;br /&gt;
&lt;br /&gt;
  TYPE dictionary_struct&lt;br /&gt;
    INTEGER,PRIVATE :: hash_size  !! The size of hash_table.&lt;br /&gt;
    TYPE(linked_list_struct),PRIVATE,ALLOCATABLE :: table(:)&lt;br /&gt;
  CONTAINS&lt;br /&gt;
    PROCEDURE :: init !!! ([hash_size])&lt;br /&gt;
      !!!  Initialize the dictionary struct.&lt;br /&gt;
      !!!  &amp;quot;hash_size&amp;quot; determines the size of hash table.&lt;br /&gt;
      !!!  Default value of hash_size is 100.&lt;br /&gt;
    PROCEDURE,PRIVATE :: hashkey !!! RESULT(key) &lt;br /&gt;
      !!!  Calculates the hashkey for the given key.&lt;br /&gt;
&lt;br /&gt;
    PROCEDURE :: has !!! (key) RESULT(T/F)&lt;br /&gt;
      !!!  Check if the dict has term with given key.&lt;br /&gt;
      !!!  Return .TRUE. if the key exists.&lt;br /&gt;
      !!!  Return .FALSE. otherwise. &lt;br /&gt;
    PROCEDURE :: get !!! (key) RESULT(DATA)&lt;br /&gt;
      !!!  Get the value of given key.&lt;br /&gt;
      !!!  If the key doesn't exist, give a warning message&lt;br /&gt;
      !!!  and return a value of &amp;quot;NaN&amp;quot;.&lt;br /&gt;
    PROCEDURE :: add !!! (DATA) RESULT(T/F)&lt;br /&gt;
      !!!  Add new term to dictionary.&lt;br /&gt;
      !!!  If the key already exists, return .FALSE. &lt;br /&gt;
      !!!  and overwrite the value as the new one.&lt;br /&gt;
      !!!  Otherwise, return .TRUE. and add the term. &lt;br /&gt;
    PROCEDURE :: add_no_overwrite !!! (DATA) RESULT(T/F)&lt;br /&gt;
      !!!  Same as add, except no overwriting.&lt;br /&gt;
    PROCEDURE :: delete  !!! (key) RESULT(T/F)&lt;br /&gt;
      !!!  Delete a term with given key from the dictionary.&lt;br /&gt;
      !!!  Returns .TRUE. if the key is found and deleted.&lt;br /&gt;
    PROCEDURE :: dict2list !!!() RESULT(list)&lt;br /&gt;
      !!!  Converts the data stored in the dictionary into&lt;br /&gt;
      !!!  linked list. This kind of operation is needed if &lt;br /&gt;
      !!!  you want to iterate through the dictionary to find&lt;br /&gt;
      !!!  something whose key is unknown.&lt;br /&gt;
      !!!  Beaware that the list here has to be initialized &lt;br /&gt;
      !!!  before this function is called.&lt;br /&gt;
    PROCEDURE :: dict2list_sort_key !!!() RESULT(list)&lt;br /&gt;
      !!!  Same as dict2list,except that the list is sorted by the &lt;br /&gt;
      !!!  value of data%val in ascending order. &lt;br /&gt;
    PROCEDURE :: dict2list_sort_val !!!() RESULT(list)&lt;br /&gt;
      !!!  Same as dict2list,except that the list is sorted by the &lt;br /&gt;
      !!!  value of data%val in ascending order. &lt;br /&gt;
&lt;br /&gt;
    FINAL :: destroy !!!() destructor.&lt;br /&gt;
  END TYPE dictionary_struct&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CONTAINS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Hash key generation algorithm==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;fortran&amp;quot;&amp;gt;&lt;br /&gt;
! Calculate the hash key for hash table.&lt;br /&gt;
!&lt;br /&gt;
  INTEGER FUNCTION hashkey( self,key )&lt;br /&gt;
    IMPLICIT NONE&lt;br /&gt;
    CLASS(dictionary_struct),INTENT(IN) :: self    &lt;br /&gt;
    INTEGER, INTENT(in) :: key&lt;br /&gt;
&lt;br /&gt;
    IF (.NOT.(ALLOCATED(self%table))) RETURN&lt;br /&gt;
    hashkey = MOD( key, self%hash_size ) + 1&lt;br /&gt;
&lt;br /&gt;
  END FUNCTION hashkey&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hirano</name></author>
	</entry>
</feed>