Special set: Stack, queue, hashtable
STACK: values are assigned one by one in sequence.
. Count: obtains the number of elements in the set.
. Push () pushes elements one by one into the collection
. Pop () will pop up a set of elements one by one
. Clear () Clear the set
Queue: first-in-first-out, one-in-one value assignment, and one-in-one value, in order.
. Count: obtains the number of elements in the set.
. Enqueue () into the queue set
. Dequeue () output queue set
. Clear clear set
Hashtable: comes out first, values are assigned one by one, but values can only be taken together.
. Add (,) add key and Element
. Remove () Remove the elements in the brackets
. Contains () indicates whether the set contains any element in parentheses.
. Count calculates the number of elements in the set.
Example 1: A stack is a zombie. It is only available after it is pushed forward.
Example 2: pop-up elements and several elements in the computing set
Example 3: view only, not remove! And compute several elements in the set.
Example 4: The queue set does not have an index for this set, so it is first available.
Example 5: calculate the number of elements in the set.
Example 6: remove the first data and calculate several elements.
Example 7: read only, do not remove, and calculate the number of elements
Example 8: determine whether an element exists in the queue set
Example 9: Create, assign, and read a hashtable hash table
Example 10: remove an element and key, and determine whether there is an element and key in the set.
Example 11: calculate the number of elements in a hash table set. Additional clearing statement
Example 12: Use enumeration to read keys and elements in a hash table set
Exercise: workbooks
Special set (examples and exercises for Stack, queue, and hashtable)