Insert new element x in the heap.
           Assumption: x is not already in the heap
551095
def push(self, x):
        """"""
        assert x not in self.rank
        i = len(self.heap)
        self.heap.append(x)    # add a new leaf
        self.rank[x] = i
        self.up(i)
501348
public void insertBetween(Instruction _prev, Instruction _next, Instruction _newOne) {
      _newOne.setNextExpr(null);
      _newOne.setPrevExpr(null);
      if (_prev == null) {
         // this is the new head
         if (_next == null) {
            head = tail = _newOne;
         } else {
            _newOne.setNextExpr(head);
            head.setPrevExpr(_newOne);
            head = _newOne;
         }
      } else if (_next == null) {
         _newOne.setPrevExpr(tail);
         tail.setNextExpr(_newOne);
         tail = _newOne;
      } else {
         _newOne.setNextExpr(_prev.getNextExpr());
         _newOne.setPrevExpr(_next.getPrevExpr());
         _prev.setNextExpr(_newOne);
         _next.setPrevExpr(_newOne);
      }

   }
521503
def Insert(self, index, rdfpathspec=None, **kwarg):
    """"""
    if rdfpathspec is None:
      rdfpathspec = self.__class__(**kwarg)

    if index == 0:
      # Copy ourselves to a temp copy.
      nested_proto = self.__class__()
      nested_proto.SetRawData(self.GetRawData())

      # Replace ourselves with the new object.
      self.SetRawData(rdfpathspec.GetRawData())

      # Append the temp copy to the end.
      self.last.nested_path = nested_proto
    else:
      previous = self[index - 1]
      rdfpathspec.last.nested_path = previous.nested_path
      previous.nested_path = rdfpathspec
904809
private void insert(E master, E current) {
		Collection<E> dependencies = getDependencies(current);
		for (E item : dependencies) {
			if (item.equals(master)) {
				generateError(master);
			}
			insert(master, item);
		}

		// insert only element does not exists
		if (output.indexOf(current)==-1)
		{		
			output.add(current);
		}
	}
905102
public int addElementAtPosition(int prevNode, int nextNode, int element,
			boolean bUnique, boolean bCallCompare, int treap) {
		int treap_ = treap;
		if (treap_ == -1) {
			if (m_defaultTreap == nullNode())
				m_defaultTreap = createTreap(-1);
			treap_ = m_defaultTreap;
		}

		// dbg_check_(m_root);
		if (getRoot_(treap_) == nullNode()) {
			assert (nextNode == nullNode() && prevNode == nullNode());
			int root = newNode_(element);
			setRoot_(root, treap_);
			addToList_(-1, root, treap_);
			return root;
		}

		int cmpNext;
		int cmpPrev;
		if (bCallCompare) {
			cmpNext = nextNode != nullNode() ? m_comparator.compare(this,
					element, nextNode) : -1;
			assert (cmpNext <= 0);
			cmpPrev = prevNode != nullNode() ? m_comparator.compare(this,
					element, prevNode) : 1;
			// cmpPrev can be negative in plane sweep when intersection is
			// detected.
		} else {
			cmpNext = -1;
			cmpPrev = 1;
		}

		if (bUnique && (cmpNext == 0 || cmpPrev == 0)) {
			m_comparator.onAddUniqueElementFailedImpl_(element);
			int cur = cmpNext == 0 ? nextNode : prevNode;
			setDuplicateElement_(cur, treap_);
			return -1;// return negative value.
		}

		int cur;
		int cmp;
		boolean bNext;
		if (nextNode != nullNode() && prevNode != nullNode()) {
			// randomize the the cost to insert a node.
			bNext = m_random > NumberUtils.nextRand(m_random) >> 1;
		} else
			bNext = nextNode != nullNode();

		if (bNext) {
			cmp = cmpNext;
			cur = nextNode;
		} else {
			cmp = cmpPrev;
			cur = prevNode;
		}

		int newNode = -1;
		int before = -1;
		boolean b_first = true;
		for (;;) {
			if (cmp < 0) {
				int left = getLeft(cur);
				if (left != nullNode())
					cur = left;
				else {
					before = cur;
					newNode = newNode_(element);
					setLeft_(cur, newNode);
					setParent_(newNode, cur);
					break;
				}
			} else {
				int right = getRight(cur);
				if (right != nullNode())
					cur = right;
				else {
					before = getNext(cur);
					newNode = newNode_(element);
					setRight_(cur, newNode);
					setParent_(newNode, cur);
					break;
				}
			}

			if (b_first) {
				cmp *= -1;
				b_first = false;
			}
		}

		bubbleUp_(newNode);
		if (getParent(newNode) == nullNode())
			setRoot_(newNode, treap_);

		addToList_(before, newNode, treap_);
		// dbg_check_(m_root);
		return newNode;
	}
177983
def push(self, element, value):
        
        insert_pos = 0
        for index, el in enumerate(self.tops):
            if not self.find_min and el[1] >= value:
                insert_pos = index+1
            elif self.find_min and el[1] <= value:
                insert_pos = index+1
        self.tops.insert(insert_pos, [element, value])
        self.tops = self.tops[:self.n]
1130775
@Override
    @LogarithmicTime(amortized = true)
    public AddressableHeap.Handle<K, V> insert(K key, V value) {
        if (other != this) {
            throw new IllegalStateException("A heap cannot be used after a meld");
        }
        if (key == null) {
            throw new NullPointerException("Null keys not permitted");
        }
        Node<K, V> n = new Node<K, V>(this, key, value);
        if (comparator == null) {
            root = link(root, n);
        } else {
            root = linkWithComparator(root, n);
        }
        size++;
        return n;
    }
470274
public static void lazyInsertAfter(Element newElement, Element after) {
        if (!after.parentNode.contains(newElement)) {
            after.parentNode.insertBefore(newElement, after.nextSibling);
        }
    }
512653
def insert(self, i, x):
        """"""
        if not isinstance(x, str):
            raise TypeError(
                'Members of this object must be strings. '
                'You supplied \"%s\"' % type(x))
        list.insert(self, i, x)
962300
protected final void insertNewContent() throws TTException {
        try {
            Stack<Long> leftSiblingKeyStack = new Stack<Long>();

            leftSiblingKeyStack.push(NULL_NODE);
            boolean firstElement = true;
            int level = 0;
            QName rootElement = null;
            boolean endElemReached = false;
            StringBuilder sBuilder = new StringBuilder();

            // Iterate over all nodes.
            while (mReader.hasNext() && !endElemReached) {
                final XMLEvent event = mReader.nextEvent();

                switch (event.getEventType()) {
                case XMLStreamConstants.START_ELEMENT:
                    level++;
                    leftSiblingKeyStack = addNewElement(leftSiblingKeyStack, (StartElement)event);
                    if (firstElement) {
                        firstElement = false;
                        rootElement = event.asStartElement().getName();
                    }
                    break;
                case XMLStreamConstants.END_ELEMENT:
                    level--;
                    if (level == 0 && rootElement != null
                        && rootElement.equals(event.asEndElement().getName())) {
                        endElemReached = true;
                    }
                    leftSiblingKeyStack.pop();
                    mWtx.moveTo(leftSiblingKeyStack.peek());
                    break;
                case XMLStreamConstants.CHARACTERS:
                    if (mReader.peek().getEventType() == XMLStreamConstants.CHARACTERS) {
                        sBuilder.append(event.asCharacters().getData().trim());
                    } else {
                        sBuilder.append(event.asCharacters().getData().trim());
                        leftSiblingKeyStack = addNewText(leftSiblingKeyStack, sBuilder.toString());
                        sBuilder = new StringBuilder();
                    }
                    break;
                default:
                    // Node kind not known.
                }
            }
        } catch (final XMLStreamException e) {
            throw new TTIOException(e);
        }
    }
164486
def push(self, el):
        
        count = next(self.counter)
        heapq.heappush(self._queue, (el, count))
852116
public void add(final float x) {
        if(isInitializing) {
            q[ni++] = x;

            if(ni == 2*m+3+1) {
                Arrays.sort(q);
                isInitializing=false;
            }
        } else {
            addMeasurement(x);
        }
    }
343312
public synchronized void insert(XEvent event, int index)
			throws IndexOutOfBoundsException, IOException {
		if (index < 0 || index > size) {
			throw new IndexOutOfBoundsException();
		}
		// check if we can append
		if (index == size) {
			append(event);
			return;
		}
		// adjust size and overflow size
		size++;
		overflowSize++;
		// add to overflow set
		for (int i = overflowSize - 2; i >= 0; i--) {
			if (overflowIndices[i] >= index) {
				overflowIndices[i + 1] = overflowIndices[i] + 1;
				overflowEntries[i + 1] = overflowEntries[i];
			} else {
				overflowIndices[i + 1] = index;
				overflowEntries[i + 1] = event;
				if (overflowSize == overflowIndices.length) {
					consolidate();
				}
				return;
			}
		}
		// if we arrive here, we must insert at zero
		overflowIndices[0] = index;
		overflowEntries[0] = event;
		if (overflowSize == overflowIndices.length) {
			consolidate();
		}
	}
682972
public Element put(int index, Element newValue) {

		Element oldValue = null;

        int size = list.size();

		if (index < 0) {
            if (index < -size) {
                // negative indices do not auto-prepend
                // (asopposed to positive ones that grow the list by appending undef)
                throw new EvaluationException(MessageUtils.format(
                    MSG_INVALID_NEGATIVE_LIST_INDEX, Integer.toString(index), size));
            } else {
                index += size;
            }
		}

		try {
			if ((newValue != null) && !(newValue instanceof Null)) {
				if (index >= size) {
					for (int i = 0; i < index - size; i++) {
						list.add(Undef.VALUE);
					}
					list.add(newValue);
				} else {
					oldValue = list.set(index, newValue);
					if (oldValue != null) {
						oldValue.checkValidReplacement(newValue);
					}
				}
			} else {
				try {
					oldValue = list.remove(index);
				} catch (IndexOutOfBoundsException ioobe) {
					// Ignore this error; removing non-existant element is OK.
				}
			}
		} catch (IndexOutOfBoundsException ioobe) {
			throw new EvaluationException(MessageUtils.format(
					MSG_NONEXISTANT_LIST_ELEMENT, Integer.toString(index)));
		}
		return oldValue;
	}
38315
def p_insertx(self,t):
    ""
    t[0] = InsertX(t[3],t[4],t[7].children,t[9])
1221893
@SuppressWarnings("unchecked")
	public static <T> Object insert(Object array, int index, T... newElements) {
		if (isEmpty(newElements)) {
			return array;
		}
		if(isEmpty(array)) {
			return newElements;
		}
		
		final int len = length(array);
		if (index < 0) {
			index = (index % len) + len;
		}
		
		final T[] result = newArray(array.getClass().getComponentType(), Math.max(len, index) + newElements.length);
		System.arraycopy(array, 0, result, 0, Math.min(len, index));
		System.arraycopy(newElements, 0, result, index, newElements.length);
		if (index < len) {
			System.arraycopy(array, index, result, index + newElements.length, len - index);
		}
		return result;
	}
265629
public void insertNode(Node n, int pos)
  {

    if (!m_mutable)
      throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");

    insertElementAt(n, pos);
  }