public void Add(int priority, T element) { i = new Item <T>(); i.priority = priority; i.element = element; priorityQueue.Add(i); bubbleSort.BubbleSorting(priorityQueue); size += 1; }
public void Add(T key, T value) { element = new Slot <T>(); element.key = key; element.value = value; if (bs.binarySearch(hashTable, element) != -1) { hashTable.Add(element); size++; } else { throw new Exception("The element already exists!"); } }
//Adding a new element on the top of the stack public void Push(T element) { stack.Add(element); size += 1; }
//Adding a new element to the end of queue public void Add(T element) { queue.Add(element); size++; }